Telerik Grid Hierarchy and Paging & Sorting not working

4 posts, 0 answers
  1. GK
    GK avatar
    11 posts
    Member since:
    Jun 2010

    Posted 28 Feb 2011 Link to this post

    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

  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 28 Feb 2011 Link to this post

    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!
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. GK
    GK avatar
    11 posts
    Member since:
    Jun 2010

    Posted 28 Feb 2011 Link to this post

    Hi Pavlina, 
    Many thanks, Its working fine.

    Thanks
    Gopi Krishna
  5. JJ
    JJ avatar
    147 posts
    Member since:
    May 2010

    Posted 28 Jul 2011 Link to this post

    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.
Back to Top