Back to Devexpress

ASPxGridView.GroupCount Property

aspnet-devexpress-dot-web-dot-aspxgridview-de4b8d25.md

latest3.8 KB
Original Source

ASPxGridView.GroupCount Property

Gets the number of grouped columns.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public int GroupCount { get; }
vb
Public ReadOnly Property GroupCount As Integer

Property Value

TypeDescription
Int32

The number of columns.

|

Remarks

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.

aspx
<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>
js
function OnEndCallback(s, e) {
    document.getElementById("groupCount").innerHTML = s.cpGroupCount;
}
csharp
protected void grid_BeforeGetCallbackResult(object sender, EventArgs e) {
    grid.JSProperties["cpGroupCount"] = grid.GroupCount;
}
vb
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.

asp-net-mvc-grid-display-group-summary-in-group-headers/CS/Sample/Controllers/GridGroupRowContentTemplate.cs#L26

csharp
private static int IndentCount { get { return Grid.GroupCount - GroupLevel - 1; } }
private static int GroupLevel { get { return Grid.DataBoundProxy.GetRowLevel(Container.VisibleIndex); } }

asp-net-mvc-grid-display-group-summary-in-group-headers/VB/Sample_VB/Controllers/GridGroupRowContentTemplate.vb#L22

vb
Get
    Return Grid.GroupCount - GroupLevel - 1
End Get

See Also

ASPxGridView Class

ASPxGridView Members

DevExpress.Web Namespace