Formula applies to:
  • current page only
  • the whole datasource
Formula type:
  • Sum
  • Average
  • Min
  • Max

You can set any formula and/or custom text for a column footer. To do so, first set the AppearanceSettings.ShowFooter property to true.

Then, hook the DataResolved event handler and you will receive 3 parameters in the event handler - the Model, the current page/filtered data and the complete data.

You can use these to calculate footer values. Check the C# code tab for implementation details.
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using Trirand.Web.Core;

namespace CoreDemo.Models
    public class OrdersJqGridModel
        public CoreGrid OrdersGrid { get; set; }

        public OrdersJqGridModel(HttpContext context)
            OrdersGrid = new CoreGrid(context)
                Columns = new List<CoreColumn>()
                    new CoreColumn
                        // Always set PrimaryKey for Add,Edit,Delete operations
                        // If not set, the first column will be assumed as primary key
                        DataField = "OrderId",
                        PrimaryKey = true,
                        Editable = false,
                        Width = 50,
                        DataType = typeof(int)                        
                    new CoreColumn
                        DataField = "CustomerId",
                        Editable = true,
                        Width = 100,
                        DataType = typeof(string),

                    new CoreColumn
                        DataField = "OrderDate",
                        Editable = true,
                        Width = 100,
                        DataFormatString = "{0:yyyy/MM/dd}",
                        DataType = typeof(DateTime)
                    new CoreColumn
                        DataField = "Freight",
                        Editable = true,
                        Width = 75,
                        DataType = typeof(double)
                    new CoreColumn
                        DataField = "ShipName",
                        Editable =  true,
                        Width = 150,
                        DataType = typeof(string)

                Width = "640",
                Height = "250",
                ToolBarSettings = new ToolBarSettings
                    ShowRefreshButton = true
@model CoreDemo.Models.OrdersJqGridModel
@using Trirand.Web.Core

<!DOCTYPE html>
<html lang="en-us">
    <meta charset="utf-8">
    <title>jqGrid for ASP.NET Core - Functionality Footer</title> 
    <!-- jQuery runtime minified -->
    <script src="~/js/jquery-3.2.1.min.js" type="text/javascript"></script>
    <!-- The jqGrid localization file we need, English in this case -->
    <script type="text/javascript" src="~/js/trirand/i18n/grid.locale-en.js"></script>
    <!-- The jqGrid client-side javascript -->
    <script type="text/javascript" src="/js/trirand/coregrid.min.js"></script>
    <!-- The jQuery UI theme that will be used by the grid. -->
    <link rel="stylesheet" type="text/css" href="" />
    <!-- The jQuery UI theme extension jqGrid needs -->    
    <link rel="stylesheet" type="text/css" href="~/css/trirand/coregrid.css" />
         @{ Html.BeginForm("functionalityfooter", "grid"); }        
            <table cellpadding="0" cellspacing="0" style="font-family: Tahoma;">
                    <td valign="top">
                        Formula applies to:<br />
                        <ul style="list-style:none">
                            <li>@Html.RadioButton("datasource", "current", (bool)ViewData["current_datasource"], new { onchange = "this.form.submit();" }) current page only</li>
                            <li>@Html.RadioButton("datasource", "all", (bool)ViewData["all_datasource"], new { onchange = "this.form.submit();" }) the whole datasource</li>
                    <td valign="top">
                        Formula type:<br />
                        <ul style="list-style: none;">
                            <li>@Html.RadioButton("formula", "sum", (bool)ViewData["sum_formula"], new { onchange = "this.form.submit();" }) Sum</li>
                            <li>@Html.RadioButton("formula", "avg", (bool)ViewData["avg_formula"], new { onchange = "this.form.submit();" }) Average</li>
                            <li>@Html.RadioButton("formula", "min", (bool)ViewData["min_formula"], new { onchange = "this.form.submit();" }) Min</li>              
                            <li>@Html.RadioButton("formula", "max", (bool)ViewData["max_formula"], new { onchange = "this.form.submit();" }) Max</li>
            <br /><br />            
    @{ Html.EndForm(); }

        @Html.Trirand().CoreGrid(Model.OrdersGrid, "FooterGrid")
    <br /><br />
         @await Component.InvokeAsync("CodeTabs", new { product = "grid", example = "functionalityfooter" })         

using System.Linq;
using CoreDemo.Extensions;
using Microsoft.AspNetCore.Mvc;
using CoreDemo.Models;
using Trirand.Web.Core;

namespace CoreDemo.Controllers.Grid
    public partial class GridController : Controller
        // This is the default action for the View. Use it to setup your grid Model.
        public ActionResult FunctionalityFooter(string datasource, string formula)
            datasource = datasource ?? "current";
            formula = formula ?? "sum";

            ViewData["current_datasource"] = datasource.Equals("current");
            ViewData["all_datasource"] = datasource.Equals("all");
            ViewData["sum_formula"] = formula.Equals("sum");
            ViewData["avg_formula"] = formula.Equals("avg");
            ViewData["min_formula"] = formula.Equals("min");
            ViewData["max_formula"] = formula.Equals("max");

            HttpContext.Session.Set<string>("formula", formula);
            HttpContext.Session.Set<string>("datasource", datasource);

            // Get the model (setup) of the grid defined in the /Models folder.
            var gridModel = new OrdersJqGridModel(HttpContext);
            var grid = gridModel.OrdersGrid;


            // Pass the custmomized grid model to the View
            return View(gridModel);

        public void SetUpGrid_FooterGrid(CoreGrid grid)
            // Customize/change some of the default settings for this model
            // ID is a mandatory field. Must by unique if you have several grids on one page.
            grid.ID = "FooterGrid";
            // Setting the DataUrl to an action (method) in the controller is required.
            // This action will return the data needed by the grid            
            grid.DataUrl = Url.Action("FunctionalityFooter_DataRequested");            
            grid.AppearanceSettings.ShowFooter = true;
            //grid.DataResolved += new CoreGridDataResolvedEventHandler(grid_DataResolved);
            grid.DataResolved = grid_DataResolved;

        // This method is called when the grid requests data. You can choose any method to call
        // by setting the CoreGrid.DataUrl property
        public JsonResult FunctionalityFooter_DataRequested()
            // Get both the grid Model and the data Model
            // The data model in our case is an autogenerated linq2sql database based on Northwind.
            var gridModel = new OrdersJqGridModel(HttpContext);
            var northWindModel = new NorthWind();


            // return the result of the DataBind method, passing the datasource as a parameter
            // jqGrid for ASP.NET Core automatically takes care of paging, sorting, filtering/searching, etc
            return gridModel.OrdersGrid.DataBind(northWindModel.Orders);

        void grid_DataResolved(CoreGridDataResolvedEventArgs e)
            string formula = HttpContext.Session.Get<string>("formula") ?? "sum";
            string data = HttpContext.Session.Get<string>("datasource") ?? "current";
            IQueryable<Order> datasource = data == "current" ? e.CurrentData.OfType<Order>() : e.AllData.OfType<Order>();
            CoreColumn freightColumn = e.GridModel.Columns.Find(c => c.DataField == "Freight");
            CoreColumn shipCityColumn = e.GridModel.Columns.Find(c => c.DataField == "CustomerId");            

            string result = "";            
            switch (formula)
                case "max": result = (from o in datasource select o.Freight).Max().ToString(); break;
                case "min": result = (from o in datasource select o.Freight).Min().ToString(); break;
                case "avg": result = (from o in datasource select o.Freight).Average().ToString(); break;
                case "sum": result = (from o in datasource select o.Freight).Sum().ToString(); break;

            freightColumn.FooterValue = result;
            shipCityColumn.FooterValue = formula.ToUpper() + ":";

Switch theme:

Theming is based on the very popular jQuery ThemeRoller standard. This is the same theming mechanism used by jQuery UI and is now a de-facto standard for jQuery based components. The benefits of using ThemeRoller are huge. We can offer a big set of ready to use themes created by professional designers, including Windows-like themes (Redmond), Apple-like theme (Cupertino), etc. In addition to that any jQuery UI controls on the same page will pick the same theme.

Last, but not least, you can always roll your own ThemeRoller theme, using the superb Theme Editor

To use a theme, simply reference 2 Css files in your Html <head> section - the ThemeRoller theme you wish to use, and the jqGrid own ThemeRoller Css file. For example (Redmond theme):

<link rel="stylesheet" type="text/css" media="screen" href="/themes/redmond/jquery-ui-1.8.2.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/themes/coregrid.css" />