GridControl.SortBy(String) Method

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

Namespace: DevExpress.Mobile.DataGrid

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


public void SortBy(
    string fieldName
Public Sub SortBy(
    fieldName As String


Name Type Description
fieldName String

A String value that specifies the column's field name.



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