Skip to main content

GridControl.SortBy(GridColumn) Method

Sorts data by the values of the specified column in ascending order.

Namespace: DevExpress.Mobile.DataGrid

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

Declaration

public void SortBy(
    GridColumn column
)

Parameters

Name Type Description
column GridColumn

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

Remarks

Important

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. To specify the sequence of applying sorting to columns, assign the GridColumn.SortIndex of these columns.

Another way to sort data in the grid by a column values is to use the column’s GridColumn.SortOrder property. 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