[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 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.


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:


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

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