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

Details Table load/render Takes longer time

4 Answers 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkata
Top achievements
Rank 1
Venkata asked on 02 Jun 2015, 09:03 PM

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;
                    }               
            }
        }

4 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 05 Jun 2015, 01:28 PM
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
0
Tonya
Top achievements
Rank 1
answered on 21 Sep 2015, 04:45 AM

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

 

 

0
Kostadin
Telerik team
answered on 23 Sep 2015, 11:02 AM
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
0
Tonya
Top achievements
Rank 1
answered on 24 Sep 2015, 01:20 AM

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 :)

Tags
Grid
Asked by
Venkata
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Tonya
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or