Grid is not paging when there are groupings

4 posts, 0 answers
  1. Márcio
    Márcio avatar
    47 posts
    Member since:
    Sep 2006

    Posted 30 Jul 2012 Link to this post

    Hi.

    I have a grid that is loaded on demand, and when I create a group and add it to the mastertableview, the Grid does not page (I click on the page 2, but it doesn't change the page and the records remain the the same of the page 1).

    What am I doind wong? Any idea?
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 31 Jul 2012 Link to this post

    Hello,

    I suppose that you are binding the grid using simple binding with DataBind() calls. If so you can transform your code to take advantage of the advanced binding with NeedDataSource handling. Thus you will be able to utilize features like paging, grouping, filtering, custom edit forms which are supported only with this type of binding or declarative data sources.

    Greetings,
    Pavlina
    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. Márcio
    Márcio avatar
    47 posts
    Member since:
    Sep 2006

    Posted 31 Jul 2012 Link to this post

    Hi, Pavlina.

    I'm actually already handling the OnNeedDataSource event for this purpose. And I must create the GridGroupByFields programmatically.

    Here's what I'm doing:

    RadGrid RadGridProcessos = (RadGrid)PlaceHolderForGrid.FindControl("RadGridProcessos");
    RadGridProcessos.MasterTableView.GroupByExpressions.Clear();
     
    GridGroupByExpression expression = new GridGroupByExpression();
    GridGroupByField gridGroupByField = new GridGroupByField();
    gridGroupByField = new GridGroupByField();
    gridGroupByField.FieldName = "NM_AREA";
    gridGroupByField.FieldAlias = "NM_AREA";
    gridGroupByField.HeaderText = "Área";
    gridGroupByField.SortOrder = GridSortOrder.Ascending;
    gridGroupByField.HeaderValueSeparator = " para o grupo atual: ";
    gridGroupByField.FormatString = "<strong>{0}</strong>";
    expression.SelectFields.Add(gridGroupByField);
     
    expression.GroupByFields.Add(gridGroupByField);
    RadGridProcessos.MasterTableView.GroupByExpressions.Add(expression);

    As fas as I know, this is correct, but when I page the Grid, it does not goes to the selected page.
    If I remove this grouping settings, it pages properly.
  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 03 Aug 2012 Link to this post

    Hi,

    The provided code looks correct and I can not say what exactly is causing this erroneous behaviour. Therefore, it will be best if you can open a formal support ticket and send us a sample runnable project which we can test locally.

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