[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Collapse]Windows 10 App Controls
 [Expand]Getting Started
  [Expand]Navigation and Layout
  [Expand]Data Editors
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Collapse]Data Management
    [Expand]Data Summaries
    [Expand]Filtering and Searching
      Sorting Overview
      Sorting in Code
      Sorting Modes and Custom Sorting
   [Expand]Data Editing
   [Expand]Asynchronous Virtual Source
   [Expand]Data Scrolling
   [Expand]Visual Elements
  [Expand]Map Control
  [Expand]PDF Viewer
   SVG Icon
   Context Menu
 [Expand]Themes and Color Schemes
  Get More Help
 [Expand]API Reference
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Sorting Overview

Expanded Overview

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.

Expanded Availability

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.

Expanded Concepts

Expanded Examples

Is this topic helpful?​​​​​​​