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

Grid is not paging when there are groupings

3 Answers 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Márcio
Top achievements
Rank 2
Márcio asked on 30 Jul 2012, 06:55 PM
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?

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 31 Jul 2012, 10:05 AM
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.
0
Márcio
Top achievements
Rank 2
answered on 31 Jul 2012, 01:28 PM
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.
0
Pavlina
Telerik team
answered on 03 Aug 2012, 01:44 PM
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.
Tags
Grid
Asked by
Márcio
Top achievements
Rank 2
Answers by
Pavlina
Telerik team
Márcio
Top achievements
Rank 2
Share this question
or