Whenever we populate a grid to display data, it always consists of multiple rows and columns in a simple tabular format. But sometimes we need to display the data in a complex format, such as with a SubGroup type where the entire data will be a sub group on the basis of a specific field value. And as per the criteria, it will also display the total number of items and also some aggregate values in the sub group footer.
Suppose we want to populate a product details grid, where we want to group the product data as per the product category and each category must display a total number of products and total prices in the group footer section. This article will show how to populate this type of grid view using a Kendo UI and jQuery.
For this, at first we need to create the model class of Product as below:
- public class Product
- {
- public string ProductName { get; set; }
- public decimal UnitPrice { get; set; }
- public int OrderUnit { get; set; }
- public int StockUnit { get; set; }
- public string ProductType { get; set; }
- }
- public ActionResult AggregatesGrid()
- {
- List<Product> lstData = GetProductList();
- return Json(lstData, JsonRequestBehavior.AllowGet);
- }
- public List<Product> GetProductList()
- {
- List<Product> lstData = new List<Product>();
- Product objData = new Product();
- objData.ProductName = "Samsung Note 3";
- objData.UnitPrice = 32000;
- objData.OrderUnit = 10;
- objData.StockUnit = 12;
- objData.ProductType = "Mobile";
- lstData.Add(objData);
- objData = new Product();
- objData.ProductName = "Nokia Lumia";
- objData.UnitPrice = 14000;
- objData.OrderUnit = 6;
- objData.StockUnit = 2;
- objData.ProductType = "Mobile";
- lstData.Add(objData);
- objData = new Product();
- objData.ProductName = "Samsung Galaxy";
- objData.UnitPrice = 18000;
- objData.OrderUnit = 3;
- objData.StockUnit = 12;
- objData.ProductType = "Mobile";
- lstData.Add(objData);
- objData = new Product();
- objData.ProductName = "Sony LED";
- objData.UnitPrice = 24000;
- objData.OrderUnit = 4;
- objData.StockUnit = 6;
- objData.ProductType = "TV";
- lstData.Add(objData);
- objData = new Product();
- objData.ProductName = "Samsung LED";
- objData.UnitPrice = 28500;
- objData.OrderUnit = 10;
- objData.StockUnit = 12;
- objData.ProductType = "TV";
- lstData.Add(objData);
- return lstData;
- }
- public ActionResult ProductGrid()
- {
- return View();
- }


Atul GatePosted May 12, 2018, 6:55 AM
Is there possible multiple groups against show only one client group footer template??
VINGYAN INNOVATIONSPosted Apr 1, 2018, 12:08 AM
Is there a way on the sub total I can show % between 2 values..as subtotal only shows sum of row values.hence % also gets summed up
kalu singh raoPosted Jul 7, 2016, 7:45 AM
Nice...
Jacob RobinsonPosted Jun 24, 2015, 6:11 AM
Nice...
Arweb AroshanzamirPosted Jan 16, 2015, 8:38 AM
good job Debasis Saha..very usefull article...thanks
Manish Kumar ChoudharyPosted Jan 15, 2015, 11:13 PM
Nice one..