Skip to main content
Tab

ASPxGridBase.SortCount Property

Gets the number of sorted columns (rows for ASPxVerticalGrid).

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

NuGet Package: DevExpress.Web

#Declaration

public int SortCount { get; }

#Property Value

Type Description
Int32

The number of columns (rows).

#Remarks

Grid controls allow users to sort data by multiple columns. Use the SortCount property to obtain the number of sorted columns.

For more information on the sort mode in a particular control, refer to the following topics:

#Example

The code sample below uses the SortCount property to display the number of sorted columns.

ASPxGridView - SortCount

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server"
    OnBeforeGetCallbackResult="grid_BeforeGetCallbackResult">
    <ClientSideEvents EndCallback="OnEndCallback" />
    <%--...--%>
</dx:ASPxGridView>
<br />
<div>
    Sorted columns count: <span id="sortCount" style="font-weight: bold">0</span>
</div>
function OnEndCallback(s, e) {
    document.getElementById("sortCount").innerHTML = s.cpSortCount;
}
protected void grid_BeforeGetCallbackResult(object sender, EventArgs e) {
    grid.JSProperties["cpSortCount"] = grid.SortCount;
}
See Also