New to Telerik UI for ASP.NET Core? Download free 30-day trial
ASP.NET Core Grid Sorting
- EXAMPLE
- VIEW SOURCE
-
Change Theme
defaultDefault Theme
- Main
- Main Dark
- Nordic
- Ocean Blue
- Ocean Blue A11Y
- Purple
- Turquoise
Bootstrap Theme- Main
- Bootstrap 3
- Bootstrap 3 Dark
- Main Dark
- Nordic
- Turquoise
- Turquoise Dark
- Urban
- Vintage
Material Theme- Main
- Arctic
- Lime Dark
- Main Dark
- Nova
Classic Theme- Main
- Green
- Green Dark
- Lavender
- Lavender Dark
- Main Dark
- Metro
- Metro Dark
- Moonlight
- Opal
- Opal Dark
- Silver
- Silver Dark
- Uniform
Fluent Theme- Main
Grid with single column sorting enabled
Ship Country | Freight | Order Date |
---|
Grid with mixed column sorting enabled
- To multi-sort the columns, hold the "CTRL" key and click the columns header.
- A single-click (without holding the "CTRL" key) on any column un-sorts the currently sorted columns and applies single-sorting to the clicked column.
Ship Country | Freight | Order Date |
---|
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.