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

Grouping issue

1 Answer 18 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 01 Nov 2013, 12:10 AM
I am having an issue with grouping, if I group by a column that contains a null value all is fine in this case the middle names have  a lot of nulls, but if I group by another column afterwards I get a crash, InvalidOpertationException Collection was modified; enumeration operation may not execute.  I am using entity framework bound directly to the grid.  Simple code below attached to an older version of adventure works, but anything with a column with nulls in it should work.  Just xaml.  Curious how to fix this or am I doing something completely wrong somewhere else?

<Window x:Class="GridGroupingTest.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                xmlns:entites="clr-namespace:GridGroupingTest"
                xmlns:system="clr-namespace:System;assembly=mscorlib"
                Title="MainWindow" Height="350" Width="525">
        <Grid>
        <telerik:RadEntityFrameworkDataSource Name="AIMEntityFrameworkDataSource" QueryName="DimCustomers">
            <telerik:RadEntityFrameworkDataSource.ObjectContext>
                <entites:AdventureWorksDW2008R2Entities1/>
            </telerik:RadEntityFrameworkDataSource.ObjectContext>
        </telerik:RadEntityFrameworkDataSource>
 
        <Border Grid.Column="0" BorderBrush="Black" BorderThickness="2" Margin="2">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
 
                <Label Content="Columns Shown:" Grid.Row="0" Grid.Column="0"/>
                <StackPanel  Background="White" Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" >
                    <ListBox ItemsSource="{Binding Columns, ElementName=RadGridView1}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <CheckBox Content="{Binding Header}" IsChecked="{Binding IsVisible, Mode=TwoWay}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>
 
                <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1">
                    <Label Content="Filters"/>
                    <telerik:RadComboBox Margin="2" Width="150" DisplayMemberPath="name" ItemsSource="{Binding Filters}"
                            SelectedItem="{Binding SelectedFilter, Mode=TwoWay}"/>
                    <Button Command="{Binding LoadFilterCommand}" Content="Load"/>
                    <Button Command="{Binding DeleteFilterCommand}" Content="Delete"/>
                    <Label Content="Save Filter Name:"/>
                    <TextBox x:Name="SaveNameTextbox" Text="{Binding SaveNameText, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="150"/>
                    <Button Command="{Binding SaveFilterCommand}" Content="Save"/>
                    <Button  Content="Default"/>
                    <Button  Content="Clear All"/>
                </StackPanel>
 
                <telerik:RadGridView x:Name="RadGridView1" Grid.Row="1" Grid.Column="1"
                             ItemsSource="{Binding DataView, ElementName=AIMEntityFrameworkDataSource}"
                             Margin="0" GroupRenderMode="Flat"
                             SelectedItem="{Binding SelectedIndex}"
                             DataLoadMode="Asynchronous"
                             RowIndicatorVisibility="Collapsed"
                             IsReadOnly="True"
                             ShowColumnSortIndexes="True"
                             AutoGenerateColumns="False"
                             CanUserFreezeColumns="True"
                             CanUserResizeColumns="True"
                             ValidatesOnDataErrors="None" >
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn Header="First" ShowDistinctFilters="False"
                                            DataMemberBinding="{Binding FirstName}" DataType="system:String" />
                        <telerik:GridViewDataColumn Header="Middle" ShowDistinctFilters="False"
                                            DataMemberBinding="{Binding MiddleName}" DataType="system:String" />
                        <telerik:GridViewDataColumn Header="Last" ShowDistinctFilters="False"
                                            DataMemberBinding="{Binding LastName}" DataType="system:String" />
 
                        <telerik:GridViewDataColumn Header="Email" ShowDistinctFilters="False"
                                            DataMemberBinding="{Binding EmailAddress}" DataType="system:String" />
                        <telerik:GridViewDataColumn Header="Education" ShowDistinctFilters="False"
                                            DataMemberBinding="{Binding EnglishEducation}" DataType="system:String" />
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>
                <telerik:RadDataPager x:Name="radDataPager" Grid.Row="2" Grid.Column="1"
                          Source="{Binding Items, ElementName=RadGridView1}"
                          PageSize="30"/>
            </Grid>
        </Border>
    </Grid>
</Window>

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 05 Nov 2013, 01:06 PM
Hello Jeff,

This looks like something we will have investigate more thoroughly. 
May I ask you to provide a small sample where we can reproduce the problem so we can debug it and see what goes wrong exactly? 

Regards,
Nik
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Jeff
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or