New to Telerik UI for WinForms? Download free 30-day trial

Sorting Expressions

Overview

The SortDescriptors collection exposes the Expression property which is used to create flexible sorting conditions. Expression is a string that contains the column name followed by "ASC" (ascending) or "DESC" (descending). The columns are sorted ascending by default. Multiple columns can be separated by commas.

Creating expressions

Creating a simple expression:

Creating simple sorting expression


this.radGridView1.SortDescriptors.Expression = "ShipName ASC";

Me.RadGridView1.SortDescriptors.Expression = "ShipName ASC"

Sorting by two columns using expressions:

Sorting by two columns, using sorting expression


this.radGridView1.SortDescriptors.Expression = "ShipName ASC, Freight DESC";

Me.RadGridView1.SortDescriptors.Expression = "ShipName ASC, Freight DESC"

See Also

In this article