Skip to main content

Grouping in Code

Do one of the following to group data on the server side:

Example

The following code shows how to group by two columns (“Country” and “City”).

The image below shows the result.

exGrouping

((GridViewDataColumn)ASPxGridView1.Columns["City"]).GroupBy();
ASPxGridView1.GroupBy(ASPxGridView1.Columns["Country"], 0);

Use the ASPxClientGridView.GroupBy method to group data on the client side.

To prevent grouping, handle the ASPxClientGridView.ColumnGrouping client event. The processed client column is identified by the event parameter’s column property. To cancel the operation, set the cancel property to true.

 

Do one of the following to ungroup data grouped by a column:

Use the ASPxClientGridView.UnGroup method to ungroup data on the client side.