Skip to main content
A newer version of this page is available. .
Tab

ASPxGridView.SortBy(GridViewColumn, ColumnSortOrder) Method

Sorts data by the specified column‘s values.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.1.dll

Declaration

public ColumnSortOrder SortBy(
    GridViewColumn column,
    ColumnSortOrder value
)

Parameters

Name Type Description
column GridViewColumn

A GridViewColumn object that represents the column within the ASPxGridView.

value ColumnSortOrder

A ColumnSortOrder enumeration value that specifies the column’s sort order.

Returns

Type Description
ColumnSortOrder

A ColumnSortOrder enumeration value that specifies the column’s sort order.

Remarks

The ASPxGridView allows data sorting by multiple columns. Any previous sorting is not cleared when calling the SortBy method. The new sort order applies an additional sorting condition to the one previously applied. The newly sorted column is appended to the collection of sorted columns. Its index within the collection can be obtained using the GridViewDataColumn.SortIndex property.

You can also use the overloaded SortBy method that allows the column’s position among sorted columns to be specified.

Sorting is allowed if the ASPxGridBehaviorSettings.AllowSort property is set to true.

See Also