New to Telerik UI for ASP.NET MVC? Start a free 30-day trial
Grouping
By default, the grouping functionality of the Telerik UI Grid for ASP.NET MVC is disabled.
For a runnable example, refer to the demo on using aggregates in the Grid.
To control grouping in the Grid, use the Groupable()
method.
Razor
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.CustomerViewModel>()
.Name("grid")
.Groupable()
...
)
Only columns that are bound to a field can be groupable. To enable grouping on a column bound to an object, bind the column to a field of that object.
You can also render groups by setting group expressions in the DataSource of the Grid even without enabling Groupable
.
Razor
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.CustomerViewModel>()
.Name("Grid")
.DataSource(dataSource => dataSource
.Ajax()
.Group(groups => groups.Add(p => p.UnitsInStock))