GridControl.SortBy(GridColumn, ColumnSortOrder, Int32) Method

Sorts data by the values of the specified column in the specified order, and places the column at the specified position among the sorted columns.

Namespace: DevExpress.Mobile.DataGrid

Assembly: DevExpress.Mobile.Grid.v18.2.dll


public void SortBy(
    GridColumn column,
    ColumnSortOrder sortOrder,
    int sortIndex
Public Sub SortBy(
    column As GridColumn,
    sortOrder As ColumnSortOrder,
    sortIndex As Integer


Name Type Description
column GridColumn

A GridColumn object or descendant that is the column within the grid.

sortOrder ColumnSortOrder

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

sortIndex Int32

An integer value that specifies the zero-based column's index among the sorted columns.



This documentation topic describes legacy technology. We no longer develop new functionality for the GridControl and suggest that you use the new DataGridView control instead.

By default, data in a grid can be sorted by one column at a time (the GridControl.SortMode property is set to GridSortMode.Single). In this case, applying sorting to a column by calling the SortBy method clears sorting previously applied to another column. If sorting data by multiple columns is enabled (the GridControl.SortMode property is set to GridSortMode.Multiple), 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.

Another way to sort data in the grid by column values is to use the GridColumn.SortOrder and GridColumn.SortIndex properties. End-users can sort data by a column using a menu that appears when they touch and hold this column, or by tapping a column header.

To clear sorting applied in the grid, call the GridControl.ClearSorting method.

See Also