New to Telerik UI for ASP.NET Core? Start a free 30-day trial
Enabling Grid Operations for a Grid Object Column
Environment
Product | Grid for Progress® Telerik® UI for ASP.NET Core |
Description
How can I enable sorting, filtering, and grouping for a column which holds complex object values by using the Grid HtmlHelper in Telerik UI for ASP.NET Core?
Solution
- Enable the sorting, grouping, and filtering through the
.Sortable()
,.Groupable()
, and.Filterable()
methods. - The
Product
Model has aCategory
property, which is a Model withCategoryID
andCategoryName
properties. Bind the column to theCategoryName
property.
Razor
@model ProjectName.Models
@(Html.Kendo().Grid<Product>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(product => product.ProductID);
columns.Bound(product => product.Category.CategoryName);
})
.Pageable()
.Sortable()
.Filterable()
.Groupable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Read", "Grid"))
)
)
For the complete implementation on how to enable sorting, filtering, and grouping in a Kendo UI Grid for ASP.NET Core when a Grid column represents complex object values, refer to this GitHub project demonstrates how to.