aspnet-devexpress-dot-web-dot-aspxgridview-de4b8d25.md
Gets the number of grouped columns.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public int GroupCount { get; }
Public ReadOnly Property GroupCount As Integer
| Type | Description |
|---|---|
| Int32 |
The number of columns.
|
ASPxGridView allows users to group its data by multiple columns. Use the GroupCount property to obtain the number of grouped columns.
To access the collection of grouped columns, call the GetGroupedColumns() method.
For more information on grouping in the grid, refer to the following topic: ASPxGridView - Group Data.
<dx:ASPxGridView ID="grid" runat="server" OnBeforeGetCallbackResult="grid_BeforeGetCallbackResult">
<ClientSideEvents EndCallback="OnEndCallback" />
<Settings ShowGroupPanel="true" />
<%--...--%>
</dx:ASPxGridView>
<div>
Grouped columns count: <span id="groupCount" style="font-weight: bold">0</span>
</div>
function OnEndCallback(s, e) {
document.getElementById("groupCount").innerHTML = s.cpGroupCount;
}
protected void grid_BeforeGetCallbackResult(object sender, EventArgs e) {
grid.JSProperties["cpGroupCount"] = grid.GroupCount;
}
Protected Sub grid_BeforeGetCallbackResult(ByVal sender As Object, ByVal e As EventArgs)
grid.JSProperties("cpGroupCount") = grid.GroupCount
End Sub
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GroupCount 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.
private static int IndentCount { get { return Grid.GroupCount - GroupLevel - 1; } }
private static int GroupLevel { get { return Grid.DataBoundProxy.GetRowLevel(Container.VisibleIndex); } }
Get
Return Grid.GroupCount - GroupLevel - 1
End Get
See Also