Number of Rows

8 posts, 0 answers
  1. Stephen
    Stephen avatar
    38 posts
    Member since:
    Mar 2008

    Posted 03 Sep 2009 Link to this post

    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.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 03 Sep 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Stephen
    Stephen avatar
    38 posts
    Member since:
    Mar 2008

    Posted 03 Sep 2009 Link to this post

    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








  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Sep 2009 Link to this post

    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.
  6. Stephen
    Stephen avatar
    38 posts
    Member since:
    Mar 2008

    Posted 08 Sep 2009 Link to this post

    Thanks. I have submitted a support ticket.
  7. Stephen
    Stephen avatar
    38 posts
    Member since:
    Mar 2008

    Posted 08 Sep 2009 Link to this post

    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.
  8. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 09 Sep 2009 Link to this post

    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.
  9. Hector
    Hector avatar
    92 posts
    Member since:
    May 2009

    Posted 02 Oct 2009 Link to this post

    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. 
Back to Top
UI for WPF is Visual Studio 2017 Ready