- 2 minutes to read
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 a sort glyph (a small arrow displayed at the right of the column header). If the data is sorted in ascending order, the sort glyph is displayed as an up-arrow. When sorting in descending order, the sort glyph is displayed as a down-arrow.
If sorting isn't applied, clicking the column's header sorts data by its values in descending order. Subsequent clicks reverse the current sort order and clear the sorting. 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 or set the DataControlBase.PreserveSorting property to true. This can be useful when it is necessary to sort against multiple columns.
To clear a column's sorting, click its header while pressing the CTRL key.
To allow end-users to sort data, set the grid's DataControlBase.AllowSorting property to true. Individual columns provide the ColumnBase.AllowSorting property, which allow the default behavior specified by the grid to be overridden. For example, this prevents an end-user from sorting data by the values of individual columns.
Sorting in code is always allowed.