This is a migrated thread and some comments may be shown as answers.

[Solved] Invalid operation exception when using DataForm and RadGridView

1 Answer 204 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
uku
Top achievements
Rank 1
uku asked on 14 Dec 2009, 10:53 AM
Hello,

I'm receiving an invalid operation exception when I try to add an item  with a dataform, when RadGridView IsReadOnly="True"
I have a master detail scenario where the data should be maintain within a dataform and not directly within the grid. But when I don't set IsReadOnly="True" for the grid the app crashes with the following exception.

Error: Unhandled Error in Silverlight Application
Code: 4004   
Category: ManagedRuntimeError      
Message: System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at Telerik.Windows.Controls.GridView.GridViewRow.<BeginEdit>b__b()    

Below you can see the XAML which I've used. I've checked this also with the Microsoft DataGrid, as you can see in the XAML code and there it works without any problems. May be you can tell me, how this master detail scenario can be done also with the Telerik grid.

  <Grid x:Name="LayoutRoot">  
      <dds:DomainDataSource x:Name="ddsTest" QueryName="GetCustomersTest" AutoLoad="True">  
            <dds:DomainDataSource.DomainContext> 
                <domain:DomainService1/> 
            </dds:DomainDataSource.DomainContext> 
            <dds:DomainDataSource.SortDescriptors> 
                <riaData:SortDescriptor PropertyPath="CustomerID" Direction="Ascending"/>  
            </dds:DomainDataSource.SortDescriptors> 
        </dds:DomainDataSource> 
 
        <StackPanel x:Name="ContentStackPanel" Style="{StaticResource ContentStackPanelStyle}">  
            <dataform:DataForm   
                             ItemsSource="{Binding Data, ElementName=ddsTest}" 
                             CurrentItem="{Binding SelectedItem, ElementName=TestList, Mode=TwoWay}"                                      
                             AutoGenerateFields="True" 
                             AutoEdit="True" AutoCommit="True" CommandButtonsVisibility="Add,Delete" 
                             > 
            </dataform:DataForm> 
            <telGrid:RadGridView x:Name="TestList" ItemsSource="{Binding Data, ElementName=ddsTest}"   
                                             IsReadOnly="True" AutoGenerateColumns="True"   
                                             > 
            </telGrid:RadGridView> 
            <!--<datagrid:DataGrid x:Name="TestList" ItemsSource="{Binding Data, ElementName=ddsTest}"   
                                             IsReadOnly="True" AutoGenerateColumns="True"   
                                             > 
            </datagrid:DataGrid>--> 
        </StackPanel> 
  </Grid> 
 

Thanks for your support

Bye

Uwe

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 16 Dec 2009, 01:37 PM
Hello uku,

We fixed a similar issue with the new version. Can you confirm that this issue can be reproduced with the latest official release (2009.3.1208 aka 2009.Q3.SP1)?


All the best,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
uku
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or