This example demonstrates how the data can be sorted programmatically.
- Using GridSortExpression class that provides sorting options for Telerik RadGrid
- Using SortExpressions collection of GridTableView class
- How to set the two different sorting modes - single or multi-column sorting of Telerik RadGrid
It also includes sorting persistence after postback operation.
The second grid on the demo allows you to apply custom sort criteria by setting the
AllowCustomSorting property for the master table. With custom sorting turned on,
RadGrid will display the sorting icons but it will not actually sort the data. You will need to perform the custom sorting manually inside the
SortCommand event handler.
Instructions
Demo instructions first grid:
- Make your choice in the configuration section and click the button to apply / clear sorting.
Demo instructions second grid:
- Click the "First Name" column to sort by string length
- Click the "Last Name" column to sort descending on first click