New to Telerik UI for ASP.NET Core? Download free 30-day trial
ASP.NET Core Grid Sorting
-
EXAMPLEVIEW SOURCE
- EDIT IN
Also available for:
CLIENT-SIDE API HTML HELPER APIDescription
The ASP.NET Core DataGrid
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.