Grouping in Code
- 2 minutes to read
This document consists of the following sections.
Server-Side Approach
To group data on the server, do one of the following:
- Call the column’s GridViewDataColumn.GroupBy method.
- Set the column’s GridViewDataColumn.GroupIndex property to a non negative value. This property specifies whether the column takes part in grouping and at which level.
- Call the Grid View‘s ASPxGridView.GroupBy method.
To ungroup data, do one of the following:
- Call the column’s GridViewDataColumn.UnGroup method.
- Set the column’s GridViewDataColumn.GroupIndex property to -1.
- Call the Grid View‘s ASPxGridView.UnGroup method.
The following methods allow you to manipulate group rows from server code:
Member | Description |
---|---|
ASPxGridView.ExpandAll | Expands all group rows. |
ASPxGridView.ExpandRow | Expands the specified group row and optionally its child group rows at all nesting levels. |
ASPxGridView.CollapseAll | Collapses all group rows. |
ASPxGridView.CollapseRow | Collapses the specified group row and optionally its child group rows at all nesting levels. |
Client-Side Approach
To group data on the client, use the ASPxClientGridView.GroupBy method.
To ungroup data, call the ASPxClientGridView.UnGroup 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.
The following methods allow you to manipulate group rows from client code:
Member | Description |
---|---|
ASPxClientGridView.ExpandAll | Expands all group rows. |
ASPxClientGridView.ExpandRow | Expands the specified group row and optionally its child group rows at all nesting levels. |
ASPxClientGridView.CollapseAll | Collapses all group rows. |
ASPxClientGridView.CollapseRow | Collapses the specified group row and optionally its child group rows at all nesting levels. |