GridViewDataColumn.GroupIndex Property
Specifies the column’s grouping level.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
Int32 | -1 | The column’s grouping level. |
Remarks
ASPxGridView allows users to group its data by multiple columns. Specify the GroupIndex
property to define the column’s grouping level. If the GroupIndex
property is set to -1
, the control does not group its data by this column.
For more information on grouping in the grid, refer to the following topic: ASPxGridView - Group Data.
Example
The example below demonstrates how to group records by first letters:
<dx:ASPxGridView ID="grid" runat="server" AutoGenerateColumns="False"
KeyFieldName="ProductID" OnBeforeColumnSortingGrouping="grid_BeforeColumnSortingGrouping">
<Columns>
<dx:GridViewDataTextColumn FieldName="ProductID" ReadOnly="True" VisibleIndex="0">
<EditFormSettings Visible="False" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Name="VisibleProductName" FieldName="ProductName" VisibleIndex="1">
<Settings AllowGroup="True" SortMode="Custom" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Name="InvisibleProductName" FieldName="ProductName" VisibleIndex="2"
Visible="False" />
<dx:GridViewDataTextColumn FieldName="UnitPrice" VisibleIndex="2" />
</Columns>
<Settings ShowGroupPanel="True" />
</dx:ASPxGridView>
protected void grid_BeforeColumnSortingGrouping(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewBeforeColumnGroupingSortingEventArgs e) {
if(e.Column.Name == "VisibleProductName")
grid.Columns["InvisibleProductName"].Visible = ((grid.Columns["VisibleProductName"] as GridViewDataColumn).GroupIndex != -1);
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GroupIndex property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.