Details Table load/render Takes longer time

5 posts, 0 answers
  1. Venkata
    Venkata avatar
    128 posts
    Member since:
    Nov 2009

    Posted 02 Jun 2015 Link to this post

    Hello,

    I have very simple grid to load 2000 rows per page. while expanding details table it's taking load/render about 10 seconds. But details table has only 3 rows.

    Here is my code. please advise me if i am doing anything wrong.

    <telerik:RadGrid ID="RadGrid1" runat="server" ShowStatusBar="true" AutoGenerateColumns="False"
                PageSize="2000" AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True"
                OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnNeedDataSource="RadGrid1_NeedDataSource">
                <PagerStyle Mode="NumericPages"></PagerStyle>
                <MasterTableView DataKeyNames="PersonID"  AllowMultiColumnSorting="True">
                     <Columns>
                        <telerik:GridBoundColumn SortExpression="LeadFullName" HeaderText="LeadFullName"                       HeaderButtonType="TextButton"  DataField="LeadFullName">
                        </telerik:GridBoundColumn>
                        
                    </Columns>
     
                    <DetailTables>
                        <telerik:GridTableView DataKeyNames="PersonID" Name="Orders" Width="100%">                      
                            <Columns>
                                <telerik:GridBoundColumn SortExpression="short_description" HeaderText="short_description" HeaderButtonType="TextButton"
                                    DataField="short_description">
                                </telerik:GridBoundColumn>                          
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                    
                </MasterTableView>
            </telerik:RadGrid>

     

               protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
            {
                if (!e.IsFromDetailTable)
                {
                    RadGrid1.DataSource = GetList();
                }
            }
     
            protected void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
            {
                GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
                switch (e.DetailTableView.Name)
                {
                    case "Orders":
                        {
                            int PersonID = Convert.ToInt32(dataItem.GetDataKeyValue("PersonID").ToString());
                            e.DetailTableView.DataSource = Claimant.GetDocuments(PersonID);
                            break;
                        }               
                }
            }

  2. Eyup
    Admin
    Eyup avatar
    3664 posts

    Posted 05 Jun 2015 Link to this post

    Hello Venkata,

    I've created a sample RadGrid web site to test the described scenario. On my side both the expanding and collapsing work quick as expected. Please run the attached application and let me know about the result.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Tonya
    Tonya avatar
    20 posts
    Member since:
    Jul 2014

    Posted 20 Sep 2015 Link to this post

    I am have a similar issue; however, I have about 750 child records tied to 250 parents. In my case, it takes a long time to load the grid the first time AND when expanding the details or when doing other actions on the page which cause postbacks. Befor​e adding the Telerik grid, the page came up within 2 seconds - now it takes over 2 minutes! My data is coming from an Oracle database package. I can use the same data for the parent & the child, but I was getting duplicates for the parent, so I am using 2 different datasets.

     

    Here's my code...

    <telerik:RadGrid ID="RadGrid1" runat="server" ShowStatusBar="false" AutoGenerateColumns="False" PageSize="50" AllowSorting="True" AllowMultiRowSelection="true" AllowPaging="false" GridLines="none" OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnNeedDataSource="RadGrid1_NeedDataSource" Width="700px" ClientSettings-Scrolling-AllowScroll="true" ClientSettings-Scrolling-UseStaticHeaders="true" >
     
        <MasterTableView DataKeyNames="ProjectID" AllowMultiColumnSorting="false" HierarchyLoadMode="ServerBind" >
     
            <DetailTables>
                <telerik:GridTableView DataKeyNames="DataElementID" Name="DataElementID" Width="100%">
     
                    <%-- Child --%>
                    <HeaderStyle Font-Bold="true"/>
                    <Columns>
                        <telerik:GridClientSelectColumn UniqueName="deSelectColumn" HeaderStyle-Width="5%" ></telerik:GridClientSelectColumn>
                        <telerik:GridTemplateColumn UniqueName="first" HeaderText="1st" HeaderStyle-Width="5%"
                          <ItemTemplate
                              <asp:CheckBox ID="CheckBox1" runat="server" /> 
                          </ItemTemplate
                        </telerik:GridTemplateColumn
                        <telerik:GridBoundColumn DataField="DataElementID" UniqueName="DataElementID" HeaderText="Data Element ID" DataType="System.Int16" HeaderStyle-Width="20%" Display="true" />
                        <telerik:GridBoundColumn DataField="ProjectAreaDescription" UniqueName="ProjectAreaDescription" HeaderText="Project Area Description" DataType="System.String" HeaderStyle-Width="40%" />
                        <telerik:GridBoundColumn DataField="ProjectDataType" UniqueName="ProjectDataType" HeaderText="Project Data Type" DataType="System.String" HeaderStyle-Width="30%" />
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
     
            <%-- Parent --%>
            <HeaderStyle Font-Bold="true"/>
            <Columns>
                <telerik:GridBoundColumn DataField="ProjectID" UniqueName="ProjectID" HeaderText="Project ID" DataType="System.Int16" Groupable="true" HeaderStyle-Width="20%" Display="true" />
                <telerik:GridBoundColumn DataField="ProjectNumber" UniqueName="ProjectNumber" HeaderText="Project Number" SortExpression="ProjectNumber" DataType="System.String" HeaderStyle-Width="20%" />
                <telerik:GridBoundColumn DataField="ContractNumber" UniqueName="ContractNumber" HeaderText="Contract Number" SortExpression="ContractNumber" DataType="System.String" HeaderStyle-Width="20%" />
                <telerik:GridBoundColumn DataField="ProjectName" UniqueName="ProjectName" HeaderText="Project Name" SortExpression="ProjectNumber" DataType="System.String" HeaderStyle-Width="40%" />
            </Columns>
     
        </MasterTableView>
     
        <ClientSettings>
            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
            <Resizing AllowColumnResize="false" />
            <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true" />
        </ClientSettings>
     
    </telerik:RadGrid>
     

    Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
     
        Dim myCollection As EMSProjects
        Dim _projectsMgr As ProjectManager = Nothing
        _projectsMgr = New ProjectManager(MyBase.CurrentUser)
     
        myCollection = _projectsMgr.GetAllProjects()
     
        RadGrid1.DataSource = ""
     
        If Not myCollection Is Nothing Then
            RadGrid1.DataSource = myCollection.Items
     
            lblTotalItems.Text = myCollection.Count
        End If
     
    End Sub
     
    Protected Sub RadGrid1_DetailTableDataBind(ByVal source As Object, ByVal e As GridDetailTableDataBindEventArgs) Handles RadGrid1.DetailTableDataBind
     
        Dim myCollection As EMSDataElements
        Dim _dataElementsMgr As DataElementManager = Nothing
        _dataElementsMgr = New DataElementManager(MyBase.CurrentUser)
     
        Dim dataItem As GridDataItem = DirectCast(e.DetailTableView.ParentItem, GridDataItem)
        Dim strProjectID As String = dataItem.GetDataKeyValue("ProjectID").ToString()
     
        myCollection = _dataElementsMgr.GetDataElementsList(0, 0, 0, CInt(strProjectID))
     
        e.DetailTableView.DataSource = myCollection.Items
     
    End Sub
     

    What am I doing wrong?

    Tonya

     

     

  4. Kostadin
    Admin
    Kostadin avatar
    1733 posts

    Posted 23 Sep 2015 Link to this post

    Hi Tonya,

    I examine the provided code and I noticed that you are using ServerBind. Keep in mind that this hierarchy load mode created the structure and binds all tables (parent and child) which in your case is a lot. I would recommend you to test Conditional mode which should work best in your scenario. Also you can compare the differences between all load modes in the following help article.

    Regards,
    Kostadin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Tonya
    Tonya avatar
    20 posts
    Member since:
    Jul 2014

    Posted 23 Sep 2015 in reply to Kostadin Link to this post

    Thank you! I was previously using ServerBind, but changed it as I thought it would help in the process to programmatically expand items for selection of items that meet a user's criteria (elsewhere on the page). I have changed things to Conditional & it seems to be a good fit. Thanks for providing the link to the article.

     

    Tonya :)

Back to Top