[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
  Prerequisites
 [Expand]Getting Started
 [Collapse]Controls
  [Expand]Navigation and Layout
  [Expand]Data Editors
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Collapse]Data Management
    [Expand]Data Summaries
    [Expand]Grouping
    [Expand]Filtering and Searching
    [Collapse]Sorting
      Sorting Overview
      Sorting in Code
      Sorting Modes and Custom Sorting
   [Expand]Data Editing
   [Expand]Validation
   [Expand]Asynchronous Virtual Source
   [Expand]Data Scrolling
   [Expand]Visual Elements
   [Expand]Examples
  [Expand]Charts
  [Expand]Map Control
  [Expand]Gauges
  [Expand]PDF Viewer
  [Expand]Scheduler
   SVG Icon
   Context Menu
 [Expand]Themes and Color Schemes
  Localization
  Get More Help
 [Expand]API Reference
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[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 in Code

Expanded Sorting

The following methods and properties can be used to sort data:

Expanded Unsorting

To unsort data by the values of a single column, do one of the following:

To clear the sorting applied to the grid, use the DataControlBase.ClearSorting method.

Note

If grouping is applied, the DataControlBase.ClearSorting method preserves sorting applied to grouping columns, because group rows are always sorted.

Expanded Sorting Events

When sorting data, the grid does the following:

Note

Group rows are always sorted. The StartSorting and EndSorting events are also raised before and after data is grouped.

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