Skip to main content
Tab

ASPxGridView.GetSortedColumns() Method

Returns a collection of sorted columns.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

public ReadOnlyCollection<GridViewDataColumn> GetSortedColumns()

Returns

Type Description
ReadOnlyCollection<GridViewDataColumn>

The collection of sorted columns.

Remarks

ASPxGridView supports data sorting by multiple columns. Call the GetSortedColumns method to access the collection of sorted columns.

For more information on sorting in the grid, refer to the following topic: ASPxGridView - Sort Data.

The code sample below uses the GetSortedColumns method to traverse through the sorted columns and sort them in descending order.

<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False"
    KeyFieldName="ProductID" OnCustomCallback="grid_CustomCallback">
    <Columns>
        <%--...--%>
    </Columns>
</dx:ASPxGridView>
protected void grid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) {
    var collection = ASPxGridView1.GetSortedColumns();
    foreach(var item in collection) {
        item.SortDescending();
    }
}
See Also