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

RadGridView slow to display large amounts of data

3 Answers 498 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.
Dylan
Top achievements
Rank 1
Dylan asked on 08 Jun 2012, 09:14 PM
Hello,

I am currently working on a application that loads a large amount of records from a database to a RadGridView. The problem I am having is when I load the dataset (usually around 3k, can be up to 8k) the RadGridView takes a very long time to load. It's not a problem with receiving the data in a speedy manner but something else. The dataset gets there fast enough.

My first inclination was to page the grid but, sadly, that would negate the whole purpose of the grid. Is there any way I can speed this up? My methods of loading the grid follow

RadGridView.ItemsSource = null;
DefaultData_Context.sp_GetData_Results.Clear();
 
DefaultData_Context.Load(DefaultData_Context.Getsp_Data_ResultQuery(), AfterLoad, true);
RadGridView.ItemsSource = DefaultData_Context.sp_GetData_Results;

and the RadGridView

<telerik:RadGridView AutoGenerateColumns="False" Name="RadGridView" Margin="20,10,20,30"
                                     Grid.Row="1" Grid.Column="1" ShowColumnFooters="True" EnableColumnVirtualization="True" EnableRowVirtualization="True">
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn x:Name="Column1" DataMemberBinding="{Binding Column1}" Header="Column1" Width="Auto" IsReadOnly="True" >
                            <telerik:GridViewDataColumn.AggregateFunctions>
                                <telerik:CountFunction Caption="Count: " />
                            </telerik:GridViewDataColumn.AggregateFunctions>
                        </telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn x:Name="Column2" DataMemberBinding="{Binding  Column2}" Header="Column2" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn x:Name="Column3" DataMemberBinding="{Binding Column3}" Header="Column3" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn x:Name="Column4" DataMemberBinding="{Binding Column4}" Header="Column4" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn x:Name="Column5" DataMemberBinding="{Binding Column5}" Header="Column5" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn x:Name="Column6" DataMemberBinding="{Binding Column6}" Header="Column6" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn x:Name="Column7" DataMemberBinding="{Binding Column7}" Header="Column7" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn x:Name="Column8" DataMemberBinding="{Binding Column8}" Header="Column8" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn x:Name="Column9" DataMemberBinding="{Binding Column9}" Header="Column9" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn x:Name="Column10" DataMemberBinding="{Binding Column10}" DataFormatString="{}{0:C}" Header="Column10" Width="Auto" IsReadOnly="True" SortingStateChanged="column10_SortingStateChanged"></telerik:GridViewDataColumn>
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>

If there is anything I can tweak to speed this up that would be great.

Thanks,

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 11 Jun 2012, 05:38 AM
Hi,

 Please make sure if your grid is not measured with infinity height - in this case any UI virtual component will attempt to create all rows for all data items at once. You can check our documentation for more info. 

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dylan
Top achievements
Rank 1
answered on 11 Jun 2012, 03:09 PM
I have been reading over the documentation and I have tried a few variations of my code and xaml to see if anything could speed it up but nothing has worked. I even hardcoded the height of the radgrid but it still took about 5 seconds to display the data.

Here is my xaml with all parents as it was when I first submitted this question. I am pretty new to silverlight so I might be missing something. If you could look it over that would be fantastic.

<navigation:Page ...>
 
    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
         
        <Border BorderThickness="1" CornerRadius="5" BorderBrush="Black" Grid.Column="1" Margin="2">
            <Grid Grid.Column="1" Name="dataGrid">
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="0" VerticalAlignment="Center" Margin="15,0" >
                    <TextBlock Name="searchCriteriaTextBlock" Text="" FontSize="14" VerticalAlignment="Center" />
                </StackPanel>
                <Grid Grid.Row="1" Grid.Column="1">
                    <telerik:RadGridView AutoGenerateColumns="False" Name="RadGridView" Margin="20,10,20,30"
                                         Grid.Row="1" Grid.Column="1" ShowColumnFooters="True" EnableColumnVirtualization="True" EnableRowVirtualization="True">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn x:Name="Column1" DataMemberBinding="{Binding Column1}" Header="Column1" Width="Auto" IsReadOnly="True" >
                                <telerik:GridViewDataColumn.AggregateFunctions>
                                    <telerik:CountFunction Caption="Count: " />
                                </telerik:GridViewDataColumn.AggregateFunctions>
                            </telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn x:Name="Column2" DataMemberBinding="{Binding  Column2}" Header="Column2" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn x:Name="Column3" DataMemberBinding="{Binding Column3}" Header="Column3" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn x:Name="Column4" DataMemberBinding="{Binding Column4}" Header="Column4" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn x:Name="Column5" DataMemberBinding="{Binding Column5}" Header="Column5" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn x:Name="Column6" DataMemberBinding="{Binding Column6}" Header="Column6" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn x:Name="Column7" DataMemberBinding="{Binding Column7}" Header="Column7" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn x:Name="Column8" DataMemberBinding="{Binding Column8}" Header="Column8" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn x:Name="Column9" DataMemberBinding="{Binding Column9}" Header="Column9" Width="Auto" IsReadOnly="True"></telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn x:Name="Column10" DataMemberBinding="{Binding Column10}" DataFormatString="{}{0:C}" Header="Column10" Width="Auto" IsReadOnly="True" SortingStateChanged="Column_SortingStateChanged"></telerik:GridViewDataColumn>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </Grid>
 
 
 
                <telerik:RadBusyIndicator Grid.Row="1" Grid.Column="1" Height="150" HorizontalAlignment="Center"
                                          Name="RadGridView_RadBusyIndicator" VerticalAlignment="Center" Width="300"
                                          BusyContent="Loading content, please wait."/>
                <Button Content="Export" Grid.Row="1" Height="23" HorizontalAlignment="right" Margin="0,15,25,0" Name="exportButton" VerticalAlignment="Top" Width="75" Click="exportButton_Click" />
            </Grid>
        </Border>
    </Grid>
</navigation:Page>

Any help will be much appreciated.

Thanks!
0
Yordanka
Telerik team
answered on 13 Jun 2012, 09:21 AM
Hi Dylan,

From the code below I cannot find the reason for the delay you get. Can you provide more details about your data - how you load them, how many items and columns have the grid?
 
Greetings,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Dylan
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Dylan
Top achievements
Rank 1
Yordanka
Telerik team
Share this question
or