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

Telerik Grid Hierarchy and Paging & Sorting not working

3 Answers 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
GK
Top achievements
Rank 1
GK asked on 28 Feb 2011, 11:35 AM
Hi,

I am using Telerik grid hierarchy of 3 levels i.e., Master Table, Details Table and Details Table. I have applied pager style

<

 

 

PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" />

 

paging for Master level with pagesize=10, and i have set paging = false for the details tables in GridTableView. It is showing like "Item 0 to 0 of 0" and only page 1 is displayed, in the paging, even If I have more than 100 rows. And sorting is also not working. Is it because of the hierarchy grid of 3 levels, these are not working?. Because these both functionalites are working at other places where I have not used any Details Table.

Below pasted is the sample code which I am using. I have removed all the columns in it.
<telerik:RadGrid ID="RadGridProject" DataSourceID="sds_p" runat="server" AllowAutomaticUpdates="True"
      AutoGenerateColumns="False" OnDataBound="RadGridProject_DataBound" PageSize="10"
      AllowSorting="true" OnItemCommand="RadGridProject_ItemCommand" AutoGenerateHierarchy="true"
      OnItemDataBound="RadGridProject_ItemDataBound" AllowCustomPaging="True">
      <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" />
      <MasterTableView Name="PTable" DataKeyNames="P_id,p_y_id" AllowMultiColumnSorting="True"
          AllowSorting="true" TableLayout="Fixed" EditMode="InPlace" AllowCustomPaging="true"
          AllowPaging="true">
          <HeaderStyle CssClass="Level1HeaderStyle" />
                   <Columns>
                   </Columns>
          <DetailTables>
              <telerik:GridTableView DataKeyNames="faf_id, faf_year_id" DataSourceID="sds_f"
                  AllowPaging="false" Width="60%" HeaderStyle-Width="10px" Name="FTable"
                  TableLayout="Auto" AllowFilteringByColumn="false">
                  <ParentTableRelation>
                      <telerik:GridRelationFields DetailKeyField="p_id" MasterKeyField="P_id" />
                  </ParentTableRelation>
                  <DetailTables>
                      <telerik:GridTableView DataSourceID="sds_d" DataKeyNames="f_id, d_id"
                          Width="80%" AllowFilteringByColumn="false" Name="DTable" runat="server"
                          AllowPaging="false" EditMode="InPlace" TableLayout="Auto">
                          <ParentTableRelation>
                              <telerik:GridRelationFields DetailKeyField="year_id" MasterKeyField="year_id" />
                          </ParentTableRelation>
                          <HeaderStyle CssClass="Level3HeaderStyle" />
                          <ItemStyle CssClass="Level3ItemStyle" Width="10px" />
                          <AlternatingItemStyle CssClass="Level3AltItemStyle" />
                          <Columns>
                             </Columns>
                          <SortExpressions>
                              <telerik:GridSortExpression FieldName="name"  sortOrder="Ascending"> </telerik:GridSortExpression>
                          </SortExpressions>
                      </telerik:GridTableView>
                  </DetailTables>
                  <ItemStyle Width="200px" />
                  <HeaderStyle CssClass="Level2HeaderStyle" Width="100%" />
                  <ItemStyle CssClass="Level2ItemStyle" />
                  <AlternatingItemStyle CssClass="Level2AltItemStyle" />
                  <Columns>
                   </Columns>
                  <SortExpressions>
                      <telerik:GridSortExpression FieldName="f_id"></telerik:GridSortExpression>
                  </SortExpressions>
              </telerik:GridTableView>
          </DetailTables>
          <SortExpressions>
              <telerik:GridSortExpression FieldName="t_name"></telerik:GridSortExpression>
          </SortExpressions>
      </MasterTableView>
      <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true">
      </ClientSettings>
  </telerik:RadGrid>

Thanks
Gopi Krishna

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 28 Feb 2011, 01:51 PM
Hello Gopi,

Try setting AllowCustomPaging property of RadGrid and MasterTableView to false and let me know how it goes:

<telerik:RadGrid ID="RadGridProject" DataSourceID="sds_p" runat="server" AllowAutomaticUpdates="True"
      AutoGenerateColumns="False" OnDataBound="RadGridProject_DataBound" PageSize="10"
      AllowSorting="true" OnItemCommand="RadGridProject_ItemCommand" AutoGenerateHierarchy="true"
      OnItemDataBound="RadGridProject_ItemDataBound" AllowCustomPaging="False"
      <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" /> 
      <MasterTableView Name="PTable" DataKeyNames="P_id,p_y_id" AllowMultiColumnSorting="True"
          AllowSorting="true" TableLayout="Fixed" EditMode="InPlace" AllowCustomPaging="false"
          AllowPaging="true"

Regards,
Pavlina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
GK
Top achievements
Rank 1
answered on 28 Feb 2011, 02:25 PM
Hi Pavlina, 
Many thanks, Its working fine.

Thanks
Gopi Krishna
0
JJ
Top achievements
Rank 1
answered on 28 Jul 2011, 05:15 PM
I used the sample.zip on the page below:
http://www.telerik.com/community/forums/aspnet-ajax/grid/hierarchy-grid-with-list-object-defined.aspx


I did set AllowCustomPaging="False" for both detail and master table.   But detail table paging still not working. - got error Object reference not set to an instnce of an object on dtailtabledatabind.
Tags
Grid
Asked by
GK
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
GK
Top achievements
Rank 1
JJ
Top achievements
Rank 1
Share this question
or