Back to Devexpress

ASPxGridBase.SortCount Property

aspnet-devexpress-dot-web-dot-aspxgridbase-dd1fcf6b.md

latest2.6 KB
Original Source

ASPxGridBase.SortCount Property

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

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

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

Property Value

TypeDescription
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.

aspx
<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server"
    OnBeforeGetCallbackResult="grid_BeforeGetCallbackResult">
    <ClientSideEvents EndCallback="OnEndCallback" />
    <%--...--%>
</dx:ASPxGridView>


<div>
    Sorted columns count: <span id="sortCount" style="font-weight: bold">0</span>
</div>
js
function OnEndCallback(s, e) {
    document.getElementById("sortCount").innerHTML = s.cpSortCount;
}
csharp
protected void grid_BeforeGetCallbackResult(object sender, EventArgs e) {
    grid.JSProperties["cpSortCount"] = grid.SortCount;
}
vb
Protected Sub grid_BeforeGetCallbackResult(ByVal sender As Object, ByVal e As EventArgs)
    grid.JSProperties("cpSortCount") = grid.SortCount
End Sub

See Also

ASPxGridBase Class

ASPxGridBase Members

DevExpress.Web Namespace