Grid with Grouping and Paging only shows first page

5 posts, 0 answers
  1. bradhh
    bradhh avatar
    25 posts
    Member since:
    Feb 2007

    Posted 16 Nov 2012 Link to this post

    This was working in previous versions of the RadControls for ASP.NET AJAX, but now with version 2012.3.1016.35 it does not. I have a grid with both grouping and paging enabled, and only the first page appears. If I remove the <telerik:GridGroupByExpression> tag from the grid then the other pages are accessible.

    Am I doing something wrong or is this a bug in the otherwise excellent Telerik controls?

    Thanks -
    Brad Harris

    Here is my markup:

    <html>
      <head>
        <title>Grid Group & Page Test</title>
      </head>
      <body>
        <form id="form1" runat="server">
          <asp:ScriptManager ID="ScriptManager1" runat="server" />
          <telerik:RadGrid
            ID="RgDamageCases"
            runat="server"
            AllowAutomaticDeletes="false"
            AllowAutomaticInserts="false"
            AllowAutomaticUpdates="false"
            AllowFilteringByColumn="true"
            AllowMultiRowEdit="false"
            AllowPaging="true"
            AllowSorting="false"
            AutoGenerateColumns="false"
            GridLines="Horizontal"
            PageSize="5"
            OnNeedDataSource="RgDamageCases_NeedDataSource"
            >
            <MasterTableView DataKeyNames="Id" CommandItemDisplay="None">
              <GroupByExpressions>
                <telerik:GridGroupByExpression>
                  <SelectFields>
                    <telerik:GridGroupByField FieldAlias="State" FieldName="State" HeaderValueSeparator=": " />
                  </SelectFields>
                  <GroupByFields>
                    <telerik:GridGroupByField FieldName="State" SortOrder="Ascending" />
                  </GroupByFields>
                </telerik:GridGroupByExpression>
              </GroupByExpressions>
              <Columns>
                <telerik:GridBoundColumn UniqueName="State" DataField="State" HeaderText="State" AllowFiltering="true"  AllowSorting="true" DataType="System.String" Visible="true" />
                <telerik:GridBoundColumn UniqueName="Name"  DataField="Name"  HeaderText="Name"  AllowFiltering="false" AllowSorting="true" DataType="System.String" Visible="true" />
              </Columns>
              <PagerStyle AlwaysVisible="true" Position="TopAndBottom" Mode="NextPrevAndNumeric" Visible="true" />
            </MasterTableView>
            <GroupingSettings CaseSensitive="false" ShowUnGroupButton="true" />
          </telerik:RadGrid>
        </form>
      </body>
    </html>

    And the codebehind:

    Imports System.Collections.ObjectModel
    Imports Telerik.Web.UI
     
     
    Partial Class GridTest01Page
        Inherits System.Web.UI.Page
     
     
      Protected Sub RgDamageCases_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs)
     
        Dim grid  As RadGrid = CType(source, RadGrid)
        Dim items As New Collection ( Of MyType )
     
        items.Add ( New MyType (  1, "001 Test", "AZ" ) )
        items.Add ( New MyType (  2, "002 Test", "AZ" ) )
        items.Add ( New MyType (  3, "003 Test", "AZ" ) )
        items.Add ( New MyType (  4, "004 Test", "AZ" ) )
        items.Add ( New MyType (  5, "005 Test", "AZ" ) )
        items.Add ( New MyType (  6, "006 Test", "AZ" ) )
        items.Add ( New MyType (  7, "007 Test", "AZ" ) )
        items.Add ( New MyType (  8, "008 Test", "AZ" ) )
        items.Add ( New MyType (  9, "009 Test", "AZ" ) )
        items.Add ( New MyType ( 10, "010 Test", "AZ" ) )
        items.Add ( New MyType ( 11, "011 Test", "AZ" ) )
     
        grid.DataSource = items
      End Sub
     
     
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ' Nothing Here
      End Sub
     
     
    End Class
     
     
    Public Class MyType
     
      Private _Id    As Integer
      Private _Name  As String
      Private _State As String
     
      Public Property Id As Integer
        Get
          Return _Id
        End Get
        Set(value As Integer)
          _Id = value
        End Set
      End Property
     
      Public Property Name As String
        Get
          Return _Name
        End Get
        Set(value As String)
          _Name = value
        End Set
      End Property
     
      Public Property State As String
        Get
          Return _State
        End Get
        Set(value As String)
          _State = value
        End Set
      End Property
     
      Public Sub New(ByVal id As Integer, ByVal name As String, ByVal state As String)
        Me.Id    = id
        Me.Name  = name
        Me.State = state
      End Sub
     
    End Class
  2. Milena
    Admin
    Milena avatar
    224 posts

    Posted 19 Nov 2012 Link to this post

    Hello,

    We are aware of this issue and our developers will give their best to ensure a proper fix for it in our next official release Q3 2012 SP1, which will be released at the beginning of December. Meantime, you can set EnableLinqGrouping property to false as a possible workaround.

    Greetings,
    Milena
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ted
    Ted avatar
    5 posts
    Member since:
    Apr 2012

    Posted 19 Nov 2012 Link to this post

    I'm seeing the same issue and EnableLinqGrouping is not working.  Only one page of data is shown in the pager when there should be many when using grouping.
  5. bradhh
    bradhh avatar
    25 posts
    Member since:
    Feb 2007

    Posted 19 Nov 2012 Link to this post

    After trying several things, I've found that adding the EnableLinqGrouping="false" attribute to the <MasterTableView> tag solved my problem:

    I hope that helps.

    <MasterTableView DataKeyNames="Id" CommandItemDisplay="None" EnableLinqGrouping="false">
       ...
    </MasterTableView>
  6. michelle
    michelle avatar
    14 posts
    Member since:
    Sep 2011

    Posted 22 May 2014 in reply to bradhh Link to this post

    So the EnableLinqGrouping="false"  did not work for me, but what did work was adding a selectfield

    <GroupByExpressions>
                        <telerik:GridGroupByExpression>
                             <SelectFields>
                                <telerik:GridGroupByField FieldAlias="AccountId" FieldName="AccountId" />
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="AccountId" SortOrder="Descending"  />
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                    </GroupByExpressions>
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017