New to Telerik UI for ASP.NET MVC? Download free 30-day trial

ASP.NET MVC Grid Sorting

Loading Demo...
  • EXAMPLE
  • VIEW SOURCE
sorting.cshtml
SortingController.cs

Also available for:

CLIENT-SIDE API SERVER-SIDE API

Description

The Telerik UI for ASP.NET MVC Grid supports built-in options which enable you to implement sorting features for the users. To set the sorting functionality, configure the .Sortable() method of the Data Grid.

The Grid component supports the Single, Multiple, and Mixed sorting modes. To specify the desired sorting mode, set the SortMode method by passing a GridSortMode the SingleColumn, MultipleColumn, or Mixed configurations in the following ways:

  • To define a single-column sorting, use the .Sortable(sortable => sortable.SortMode(GridSortMode.SingleColumn) configuration.
  • To define a multi-column sorting, use the .Sortable(sortable => sortable.SortMode(GridSortMode.MultipleColumn) definition.
  • To define a mixed-column sorting, use the .Sortable(sortable => sortable.SortMode(GridSortMode.Mixed) definition.

To define the initial sort direction use the InitialDirection() method by setting .Sortable(sortable => sortable.InitialDirection("desc")).

For more information, refer to the official Telerik UI for ASP.NET MVC Data Grid product documentation on the available sorting capabilities.

Additional Apps

This Grid example is part of a unique collection of hundreds of ASP.NET MVC demos, with which you can see all Telerik ASP.NET MVC components and their features in action. View the source code of the demos from the library or directly adapt, and edit them and their theme appearance in the ThemeBuilder.

Support & Learning Resources

Additional Resources