New to Telerik UI for ASP.NET Core? Download free 30-day trial

Show or Hide Grid Aggregates


Product Telerik UI for ASP.NET Core Grid
Progress Telerik UI for ASP.NET Core version Created with the 2022.2.621 version


How to show and hide the aggregates in the Telerik UI for ASP.NET Core Grid?


  1. Hook up for the event that, when triggered, will toggle the aggregates. The example below uses the Change event of the Switch component.
  2. Show or hide the aggregates based on a condition. To set up the aggregates, you can use the aggregate method of the DataSource. To show or hide the aggregates, you can change the value of the template. The example below uses the footerTemplate of the Grid in which the aggregate values are displayed.
        .Events(e => e.Change("onChange"))
        .Messages(c => c.Checked("Show Aggregates").Unchecked("Hide Aggregates"))
        .HtmlAttributes(new {style = "width:150px"})

        .Columns(columns =>
            columns.Bound(p => p.ProductName);
            columns.Bound(p => p.UnitsInStock).Width(100);
            columns.Bound(p => p.Discontinued).Width(100);
            columns.Bound(p => p.UnitPrice).Width(100);
        .HtmlAttributes(new { style = "height:430px;" })
        .DataSource(dataSource => dataSource
            .Read(read => read.Action("EditingInline_Read", "Grid"))
    function onChange(e){
        var grid = $("#grid").data("kendoGrid");

            var aggregates = [{ field: "UnitPrice", aggregate: "sum"}];
            grid.columns[3].footerTemplate = "Sum: #=data.UnitPrice.sum == 0?'Calculating':data.UnitPrice.sum#";
                columns: grid.columns
            grid.columns[3].footerTemplate = "";
                columns: grid.columns

For the complete implementation of the suggested approach, refer to the following Telerik REPL example.

More ASP.NET Core Grid Resources

See Also

In this article