New to Telerik UI for ASP.NET CoreStart a free 30-day trial

Enabling Grid Operations for a Grid Object Column

Environment

ProductGrid 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 a Category property, which is a Model with CategoryID and CategoryName properties. Bind the column to the CategoryName 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.

More ASP.NET Core Grid Resources

See Also