Skip to main content

GridColumn.SortOrder Property

Gets or sets the column’s sort order.

Namespace: DevExpress.XtraGrid.Columns

Assembly: DevExpress.XtraGrid.v22.2.dll

NuGet Package: DevExpress.Win.Grid


public ColumnSortOrder SortOrder { get; set; }

Property Value

Type Default Description
ColumnSortOrder None

A ColumnSortOrder enumeration value specifying the column’s sort order.

Available values:

Name Description

No sorting is applied to a column.


Sorts the column in ascending order.


Sorts the columns in descending order.


Read the SortOrder property value to determine which sort order is currently applied to the column. Assign a value to this property to sort data by the current column’s values. Note that any previous sorting is not cleared when changing the SortOrder property value. The new sort order applies an additional sorting condition to that previously applied. The newly sorted column is added to the ColumnView.SortedColumns collection as the result. Its index within the collection can be obtained using the GridColumn.SortIndex property.

The GridColumn.SortMode property specifies how the column’s data is sorted (by display text, edit values or using a custom sorting algorithm).

To clear the sorting applied previously, call the View’s ColumnView.ClearSorting method.

If you need to change the SortOrder property value in the form’s Load event handler, you should call the GridControl.ForceInitialize method in advance.

To learn more about sorting, see the Sorting in Code topic.


The following example sorts data by two columns in a Grid View. The code is enclosed within calls to the ColumnView.BeginDataUpdate and BaseView.EndDataUpdate methods. This speeds up performance by sorting the data only once, after the BaseView.EndDataUpdate method is called.

    try {
        gridView1.Columns["Trademark"].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
        gridView1.Columns["Model"].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
    finally {
See Also