Skip to main content

Sorting

  • 2 minutes to read

The GridControl‘s data can be sorted by an unlimited number of columns. To sort data against a column or to change a column’s sort order, an end user can click its header. The column’s current sort order is indicated by the sort glyph (a small arrow displayed at the column header’s right edge). If the data is sorted in ascending order, the sort glyph represents an up-arrow. When sorting in descending order, the sort glyph is displayed as a down-arrow.

SortingOverview

If sorting isn’t applied, clicking the column’s header sorts data by its values in ascending order. If sorting is already applied to the column, subsequent clicks reverse the current sort order. A regular click on a column header clears the sort settings on any other columns. To preserve the existing sort settings of other columns, hold the SHIFT key down while clicking. This can be useful when it is needed to sort against multiple columns.

To clear a column’s sorting, click its header while pressing the CTRL key.

Availability

To allow end users to sort data, set the View’s DataViewBase.AllowSorting property to true. Individual columns have the ColumnBase.AllowSorting property, which allows the default behavior specified by the view to be overridden.

Sorting in code is always allowed.

Note

The GridControl ignores custom CellTemplates when users sort data. Use other techniques to format cell values if you want to affect sort operations.

Concepts

Examples

See Also