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

Number of Rows

7 Answers 340 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 2
Stephen asked on 03 Sep 2009, 01:21 PM
Is there a practical limit to the number of rows in a GridView? I tried putting 4k in and get a memory exception. If I limit to 1k rows it works but I can see the system memory take a steep rise each time I refresh the grid. I have a similar application in WinForms and I can load 4k rows easily with no impact on system performance.

7 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 03 Sep 2009, 01:33 PM
Hi Stephen,

We have an example where the grid is bound to 1 mil. reocrds:
http://demos.telerik.com/wpf/?GridView/WPF/Performance/ClientSide

Can you provide a bit more info about your collection of objects?

Greetings,
Vlad
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.
0
Stephen
Top achievements
Rank 2
answered on 03 Sep 2009, 02:12 PM
I thought this was too low a count to be real so I think I may be doing something wrong.

This is the class I load
        public int CMGSecurityID { get; set; }
        public string Portfolio { get; set; }
        public string Cusip { get; set; }
        public string Description { get; set; }
        public string Ticker { get; set; }
        public Decimal Coupon { get; set; }
        public DateTime? Maturity { get; set; }
        public DateTime EffectiveDate { get; set; }
        public Decimal Price { get; set; }
        public string Currency { get; set; }
        public Decimal FxRate { get; set; }
        public string Source { get; set; }
        public string SecurityType { get; set; }

which is contained in a list
       public class CMGSecurityCollection : List<CMGSecurity>, IBindingList

which i stored in a query class
      class SP_Security
          public CMGPositionRecCollection RecCollection { get; set; }

Then I attach that to the grid via
       gridViewSecurities.ItemsSource = ((SP_Security)query).RecCollection;

The grid itself is pretty straight forward
            <telerik:RadTabItem Header="Securities" Name="tabItemSecurities">
                <StackPanel Orientation="Vertical">
                    <TextBlock Name="securitiesTitle"></TextBlock>
                    <telerik:RadGridView x:Name="gridViewSecurities" AutoGenerateColumns="False">
                        <telerik:RadGridView.Resources>
                            <ContextMenu x:Key="MyContextMenu" Opened="ContextMenu_Opened">
                                <MenuItem Header="Details" Name="mnuDetails"  Click="ShowSecurityDetails" />
                            </ContextMenu>
                        </telerik:RadGridView.Resources>
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn UniqueName="Portfolio" HeaderText="Portfolio" DataMemberBinding="{Binding Portfolio}"/>
                            <telerik:GridViewDataColumn UniqueName="Cusip" HeaderText="Cusip" DataMemberBinding="{Binding Cusip}"/>
                            <telerik:GridViewDataColumn UniqueName="Description" HeaderText="Description" DataMemberBinding="{Binding Description}"/>
                            <telerik:GridViewDataColumn UniqueName="Ticker" HeaderText="Ticker" DataMemberBinding="{Binding Ticker}"/>
                            <telerik:GridViewDataColumn UniqueName="Coupon" HeaderText="Coupon" DataMemberBinding="{Binding Coupon}"/>
                            <telerik:GridViewDataColumn UniqueName="Maturity" HeaderText="Maturity" DataMemberBinding="{Binding Maturity}"
                                DataFormatString="{}{0:yyyy-MM-dd}" />
                            <telerik:GridViewDataColumn UniqueName="EffectiveDate" HeaderText="EffectiveDate" DataMemberBinding="{Binding EffectiveDate}"
                                DataFormatString="{}{0:yyyy-MM-dd}" />
                            <telerik:GridViewDataColumn UniqueName="Price" HeaderText="Price" DataMemberBinding="{Binding Price}"/>
                            <telerik:GridViewDataColumn UniqueName="Currency" HeaderText="Currency" DataMemberBinding="{Binding Currency}"/>
                            <telerik:GridViewDataColumn UniqueName="FxRate" HeaderText="FxRate" DataMemberBinding="{Binding FxRate}"/>
                            <telerik:GridViewDataColumn UniqueName="Source" HeaderText="Source" DataMemberBinding="{Binding Source}"/>
                            <telerik:GridViewDataColumn UniqueName="SecurityType" HeaderText="SecurityType" DataMemberBinding="{Binding SecurityType}"/>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </StackPanel>
            </telerik:RadTabItem>

which all works pretty well with just a few items .

Stephen








0
Vlad
Telerik team
answered on 08 Sep 2009, 06:32 AM
Hello Stephen,

Unfortunately we were unable to reproduce any slowness with provided snippet. Can you send us small project (via support ticket) where this problem can be reproduced and debugged?

Sincerely yours,
Vlad
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.
0
Stephen
Top achievements
Rank 2
answered on 08 Sep 2009, 06:07 PM
Thanks. I have submitted a support ticket.
0
Stephen
Top achievements
Rank 2
answered on 08 Sep 2009, 07:28 PM
I have found that the problem does not occur when I simply the screen layout. The grid is inside a StackPanel which is on a RadTabItem. When I remove all those layers it appears to work correctly.
0
Vlad
Telerik team
answered on 09 Sep 2009, 05:30 AM
Hello Stephen,

When the grid is inside StackPanel or ScrollViewer there will be no rows virtualization - the grid will be measured with infinity Height and will try to create all rows.

All the best,
Vlad
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.
0
Hector
Top achievements
Rank 1
answered on 02 Oct 2009, 08:52 PM
OMG, this post saved me!  I had a similiar situation where my gridview began having data loading issues all of a sudden.  I didn't make any significant changes, so I could not figure out why it started taking so long to load the data and to select all and selecting individual rows.  I created a test control and put it insdie a grid and it worked perfect retrieving from the same data.  Just by luck I added a stack panel and that test control began having the same issues.  So I created another test control and that one was working fine.  Comparing the two, the only difference I noted was that the slow one was insde a stack panel, the good one was inside a grid.  So I narrowed it to the stack panel and I found this thread. 
The only thing that on my project, I had my gridview not insde a StackPanel but a grid, however, the height of the row it was in was set to Auto (*) which gave it the same effect.
Thanks, Vlad, I am very greatful for your response as it explained it to me. 
Tags
GridView
Asked by
Stephen
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Stephen
Top achievements
Rank 2
Hector
Top achievements
Rank 1
Share this question
or