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

ASP.NET Core Grid Sorting

Loading Demo...
  • EXAMPLE
  • VIEW SOURCE
  • Edit in Telerik REPL
HtmlHelper
TagHelper
Files:
sorting.cshtml
SortingController.cs
OrderViewModel.cs
Sorting_TagHelper.cshtml

Also available for:

CLIENT-SIDE API HTML HELPER API

Description

The Telerik UI for ASP.NET Core 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 Core Data Grid product documentation on the available sorting capabilities.

Additional Apps

This Grid example is part of unique collection of hundreds of ASP.NET Core demos, with which you can see all Telerik ASP.NET Core 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 Telerik REPL for ASP.NET Core or ThemeBuilder.

Support & Learning Resources

Additional Resources