Grouping in Code

To group data on a server, do one of the following.

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);

To group data on a client, use the ASPxClientGridView.GroupBy method.

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.

 

To ungroup data by the values of a specified column, do the following.

To ungroup data on a client, use the ASPxClientGridView.UnGroup method.