Example of Column Template in ASP.NET MVC Data Grid Control
This sample demonstrates the usage of template columns in a Grid. In this sample, custom images are shown in the Employee Image column.
@Html.UiGrid(new UiGridOptions
{
Id = "FlatGrid",
Data = ViewData["dataSource"],
Height = "359px",
AllowSorting = true,
AllowFiltering = true,
FilterType = UiGridFilterType.CheckBox,
OnQueryCellInfo = "queryCellInfo",
Columns = new List<UiGridColumn>
{
new UiGridColumn { HeaderText = "Image", TextAlign = UiTextAlign.Center, Template = "#imageCell", Width = 180 },
new UiGridColumn { Field = "EmployeeID", HeaderText = "ID", Width = 160 },
new UiGridColumn { Field = "Name", HeaderText = "Name", Width = 120 },
new UiGridColumn { Field = "MailID", HeaderText = "Email ID", Width = 150, Template = "#mailIDTemplate" },
new UiGridColumn { Field = "DateOfJoining", HeaderText = "Date Joined", Type = UiColumnType.Date, Width = 170, TextAlign = UiTextAlign.Right, Format = "M/d/yyyy" },
new UiGridColumn { Field = "Designation", HeaderText = "Designation", Width = 160 },
new UiGridColumn { Field = "Team", HeaderText = "Team(s)", Width = 160 },
new UiGridColumn { Field = "ReportTo", HeaderText = "Reporter", Width = 120 },
new UiGridColumn { Field = "EmployeeAvailability", HeaderText = "Availability", Width = 200 },
new UiGridColumn { Field = "YearOfExperience", HeaderText = "Experience", Width = 200 },
new UiGridColumn { Field = "AssetKit", HeaderText = "Asset Kit", Width = 180 },
new UiGridColumn { Field = "AssetKitDistribution", HeaderText = "Assigned Date", Type = UiColumnType.Date, Width = 170, TextAlign = UiTextAlign.Right, Format = "M/d/yyyy" },
new UiGridColumn { Field = "Location", HeaderText = "Location", Width = 150, Template = "#locationTemplate" },
new UiGridColumn { Field = "PhoneNumber", HeaderText = "Contact No", Width = 150, TextAlign = UiTextAlign.Right }
}
})
<style>
.image { display: inline-flex; align-items: center; justify-content: center; width: 55px; height: 55px; border-radius: 50px; color: #fff; font-weight: 600;
box-shadow: inset 0 0 1px #e0e0e0, inset 0 0 14px rgba(0, 0, 0, 0.2); }
.statustemp { width: 100px; height: 30px; text-align: center; line-height: 30px; color: #fff; }
.statustemp.availablecolor { background-color: #58d378; }
.statustemp.notavailablecolor { background-color: indianred; }
.location-icon { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #0f6cbd; }
.grid-asset-kit .asset-chip { display: inline-block; margin: 0 4px 2px 0; padding: 1px 10px; border-radius: 12px; background: #e8e8e8; font-size: 12px; }
</style>
<template id="imageCell"><span></span></template>
<template id="mailIDTemplate"><a href="mailto:${MailID}">${MailID}</a></template>
<template id="locationTemplate"><div><span class="location-icon" aria-hidden="true"></span>${Location}</div></template>
@Html.UiGrid(new UiGridOptions
{
Id = "FlatGrid",
Data = ViewData["dataSource"],
Height = "359px",
AllowSorting = true,
AllowFiltering = true,
FilterType = UiGridFilterType.CheckBox,
OnQueryCellInfo = "queryCellInfo",
Columns = new List<UiGridColumn>
{
new UiGridColumn { HeaderText = "Image", TextAlign = UiTextAlign.Center, Template = "#imageCell", Width = 180 },
new UiGridColumn { Field = "EmployeeID", HeaderText = "ID", Width = 160 },
new UiGridColumn { Field = "Name", HeaderText = "Name", Width = 120 },
new UiGridColumn { Field = "MailID", HeaderText = "Email ID", Width = 150, Template = "#mailIDTemplate" },
new UiGridColumn { Field = "DateOfJoining", HeaderText = "Date Joined", Type = UiColumnType.Date, Width = 170, TextAlign = UiTextAlign.Right, Format = "M/d/yyyy" },
new UiGridColumn { Field = "Designation", HeaderText = "Designation", Width = 160 },
new UiGridColumn { Field = "Team", HeaderText = "Team(s)", Width = 160 },
new UiGridColumn { Field = "ReportTo", HeaderText = "Reporter", Width = 120 },
new UiGridColumn { Field = "EmployeeAvailability", HeaderText = "Availability", Width = 200 },
new UiGridColumn { Field = "YearOfExperience", HeaderText = "Experience", Width = 200 },
new UiGridColumn { Field = "AssetKit", HeaderText = "Asset Kit", Width = 180 },
new UiGridColumn { Field = "AssetKitDistribution", HeaderText = "Assigned Date", Type = UiColumnType.Date, Width = 170, TextAlign = UiTextAlign.Right, Format = "M/d/yyyy" },
new UiGridColumn { Field = "Location", HeaderText = "Location", Width = 150, Template = "#locationTemplate" },
new UiGridColumn { Field = "PhoneNumber", HeaderText = "Contact No", Width = 150, TextAlign = UiTextAlign.Right }
}
})
<script>
// Syncfusion builds these cells with template functions; here OnQueryCellInfo fills them (args.content is the element the cell shows, args.data the row).
// The picture is the employee's initials in a circle (the employee photos are not part of this demo).
function queryCellInfo(args) {
if (args.column === null && args.headerText === 'Image') {
var circle = document.createElement('div');
circle.className = 'image';
circle.style.background = 'hsl(' + (parseInt(String(args.data.EmployeeID).replace(/\D/g, ''), 10) * 47 % 360) + ', 45%, 45%)';
circle.setAttribute('role', 'img');
circle.setAttribute('aria-label', args.data.EmployeeID);
circle.textContent = String(args.data.Name || '').split(' ').map(function (p) { return p.charAt(0); }).join('').slice(0, 2).toUpperCase();
args.content = circle;
} else if (args.column === 'EmployeeAvailability') {
var available = args.data.EmployeeAvailability === 'Available';
var box = document.createElement('div');
box.className = 'statustemp ' + (available ? 'availablecolor' : 'notavailablecolor');
box.textContent = available ? 'Available' : 'Not Available';
args.content = box;
} else if (args.column === 'AssetKit') {
var holder = document.createElement('div');
holder.className = 'grid-asset-kit';
String(args.data.AssetKit || '').split(',').forEach(function (kit) {
var chip = document.createElement('span');
chip.className = 'asset-chip';
chip.textContent = kit.trim();
holder.appendChild(chip);
});
args.content = holder;
}
}
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class GridController : Controller
{
// The page is Views/Grid/ColumnTemplate.cshtml; it draws what ViewData holds.
public ActionResult ColumnTemplate()
{
var employee = EmployeeDetails.GetAllRecords();
ViewData["dataSource"] = employee;
return View();
}
public class Customer
{
public Customer(){}
public Customer(string CustomerID, string ContactName, string CompanyName, string Address, string Country) {
this.CustomerID = CustomerID;
this.CompanyName = CompanyName;
this.ContactName = ContactName;
this.Address = Address;
this.Country = Country;
}
public static List<Customer> GetAllRecords()
{
List<Customer> cust = new List<Customer>();
cust.Add(new Customer("ALFKI", "Maria", "Alfreds Futterkiste", "Obere Str. 57", "Germany"));
cust.Add(new Customer("ANATR", "Ana Trujillo", "Ana Trujillo Emparedados y helados", "Avda. de la Constitución 2222", "Mexico"));
cust.Add(new Customer("BLONP", "Frédérique Citeaux", "Blondesddsl père et fils", "24, place Kléber", "France"));
cust.Add(new Customer("BOLID", "Martín Sommer", "Bólido Comidas preparadas", "C/ Araquil, 67", "Spain"));
cust.Add(new Customer("ANTON", "Elizabeth Lincoln", "Bottom-Dollar Markets", "23 Tsawassen Blvd.", "Canada"));
//cust.Add(new Customer("BONAP", "Laurence Lebihan", "Bon app", "12, rue des Bouchers", "France"));
//cust.Add(new Customer("BSBEV", "Victoria Ashworth", "B's Beverages", "Fauntleroy Circus", "UK"));
//cust.Add(new Customer("CACTU", "Patricio Simpson", "Cactus Comidas para llevar", "Cerrito 333", "Argentina"));
//cust.Add(new Customer("CENTC", "Francisco Chang", "Centro comercial Moctezuma", "Sierras de Granada 9993", "Mexico"));
//cust.Add(new Customer("CHOPS", "Yang Wang", "Chop-suey Chinese", "Hauptstr. 29", "Switzerland"));
//cust.Add(new Customer("COMMI", "Pedro Afonso", "Comércio Mineiro", "Av. dos Lusíadas, 23", "Brazil"));
//cust.Add(new Customer("CONSH", "Elizabeth Brown", "Consolidated Holdings", "Berkeley Gardens 12 Brewery", "UK"));
//cust.Add(new Customer("DRACD", "Sven Ottlieb", "Drachenblut Delikatessen", "Walserweg 21", "Germany"));
//cust.Add(new Customer("DUMON", "Janine Labrune", "Du monde entier", "67, rue des Cinquante Otages", "France"));
//cust.Add(new Customer("EASTC", "Ann Devon", "Eastern Connection", "35 King George", "UK"));
//cust.Add(new Customer("ERNSH", "Roland Mendel", "Ernst Handel", "Kirchgasse 6", "Austria"));
//cust.Add(new Customer("FAMIA", "Aria Cruz", "Familia Arquibaldo", "Rua Orós, 92", "Brazil"));
//cust.Add(new Customer("FISSA", "Diego Roel", "FISSA Fabrica Inter. Salchichas S.A.", "C/ Moralzarzal, 86", "Spain"));
//cust.Add(new Customer("FOLIG", "Martine Rancé", "Folies gourmandes", "184, chaussée de Tournai", "France"));
//cust.Add(new Customer("FOLKO", "Maria Larsson", "Folk och fä HB", "Åkergatan 24", "Sweden"));
//cust.Add(new Customer("FRANK", "Peter Franken", "Frankenversand", "Berliner Platz 43", "Germany"));
//cust.Add(new Customer("FRANR", "Carine Schmitt", "France restauration", "54, rue Royale", "France"));
//cust.Add(new Customer("FRANS", "Paolo Accorti", "Franchi S.p.A.", "Via Monte Bianco 34", "Italy"));
//cust.Add(new Customer("FURIB", "Lino Rodriguez", "Furia Bacalhau e Frutos do Mar", "Jardim das rosas n. 32", "Portugal"));
//cust.Add(new Customer("GALED", "Eduardo Saavedra", "Galería del gastrónomo", "Rambla de Cataluña, 23", "Spain"));
//cust.Add(new Customer("GODOS", "José Pedro Freyre", "Godos Cocina Típica", "C/ Romero, 33", "Spain"));
//cust.Add(new Customer("GOURL", "André Fonseca", "Gourmet Lanchonetes", "Av. Brasil, 442", "Brazil"));
//cust.Add(new Customer("GREAL", "Howard Snyder", "Great Lakes Food Market", "2732 Baker Blvd.", "USA"));
//cust.Add(new Customer("GROSR", "Manuel Pereira", "GROSELLA-Restaurante", "5ª Ave. Los Palos Grandes", "Venezuela"));
//cust.Add(new Customer("HANAR", "Mario Pontes", "Hanari Carnes", "Rua do Paço, 67", "Brazil"));
//cust.Add(new Customer("HILAA", "Carlos Hernández", "HILARION-Abastos", "Carrera 22 con Ave. Carlos Soublette #8-35", "Venezuela"));
//cust.Add(new Customer("HUNGC", "Yoshi Latimer", "Hungry Coyote Import Store", "City Center Plaza 516 Main St.", "USA"));
//cust.Add(new Customer("HUNGO", "Patricia McKenna", "Hungry Owl All-Night Grocers", "8 Johnstown Road", "Ireland"));
//cust.Add(new Customer("ISLAT", "Helen Bennett", "Island Trading", "Garden House Crowther Way", "UK"));
//cust.Add(new Customer("KOENE", "Philip Cramer", "Königlich Essen", "Maubelstr. 90", "Germany"));
//cust.Add(new Customer("LACOR", "Daniel Tonini", "La corne d'abondance", "67, avenue de l'Europe", "France"));
//cust.Add(new Customer("LAMAI", "Annette Roulet", "La maison d'Asie", "1 rue Alsace-Lorraine", "France"));
//cust.Add(new Customer("LAUGB", "Yoshi Tannamuri", "Laughing Bacchus Wine Cellars", "1900 Oak St.", "Canada"));
//cust.Add(new Customer("LAZYK", "John Steel", "Lazy K Kountry Store", "12 Orchestra Terrace", "USA"));
//cust.Add(new Customer("LEHMS", "Renate Messner", "Lehmanns Marktstand", "Magazinweg 7", "Germany"));
//cust.Add(new Customer("LETSS", "Jaime Yorres", "Let's Stop N Shop", "87 Polk St. Suite 5", "USA"));
//cust.Add(new Customer("LILAS", "Carlos González", "LILA-Supermercado", "Carrera 52 con Ave. Bolívar #65-98 Llano Largo", "Venezuela"));
//cust.Add(new Customer("LINOD", "Felipe Izquierdo", "LINO-Delicateses", "Ave. 5 de Mayo Porlamar", "Venezuela"));
//cust.Add(new Customer("LONEP", "Fran Wilson", "Lonesome Pine Restaurant", "89 Chiaroscuro Rd.", "USA"));
//cust.Add(new Customer("MAGAA", "Giovanni Rovelli", "Magazzini Alimentari Riuniti", "Via Ludovico il Moro 22", "Italy"));
//cust.Add(new Customer("MAISD", "Catherine Dewey", "Maison Dewey", "Rue Joseph-Bens 532", "Belgium"));
//cust.Add(new Customer("MEREP", "Jean Fresnière", "Mère Paillarde", "43 rue St. Laurent", "Canada"));
//cust.Add(new Customer("MORGK", "Alexander Feuer", "Morgenstern Gesundkost", "Heerstr. 22", "Germany"));
//cust.Add(new Customer("NORTS", "Simon Crowther", "North/South", "South House 300 Queensbridge", "UK"));
//cust.Add(new Customer("OCEAN", "Yvonne Moncada", "Océano Atlántico Ltda.", "Ing. Gustavo Moncada 8585 Piso 20-A", "Argentina"));
//cust.Add(new Customer("OLDWO", "Rene Phillips", "Old World Delicatessen", "2743 Bering St.", "USA"));
//cust.Add(new Customer("OTTIK", "Henriette Pfalzheim", "Ottilies Käseladen", "Mehrheimerstr. 369", "Germany"));
//cust.Add(new Customer("PARIS", "Marie Bertrand", "Paris spécialités", "265, boulevard Charonne", "France"));
//cust.Add(new Customer("PERIC", "Guillermo Fernández", "Pericles Comidas clásicas", "Calle Dr. Jorge Cash 321", "Mexico"));
//cust.Add(new Customer("PICCO", "Georg Pipps", "Piccolo und mehr", "Geislweg 14", "Austria"));
//cust.Add(new Customer("PRINI", "Isabel de Castro", "Princesa Isabel Vinhos", "Estrada da saúde n. 58", "Portugal"));
//cust.Add(new Customer("QUEDE", "Bernardo Batista", "Que Delícia", "Rua da Panificadora, 12", "Brazil"));
//cust.Add(new Customer("QUEEN", "Lúcia Carvalho", "Queen Cozinha", "Alameda dos Canàrios, 891", "Brazil"));
//cust.Add(new Customer("QUICK", "Horst Kloss", "QUICK-Stop", "Taucherstraße 10", "Germany"));
//cust.Add(new Customer("RANCH", "Sergio Gutiérrez", "Rancho grande", "Av. del Libertador 900", "Argentina"));
//cust.Add(new Customer("RATTC", "Paula Wilson", "Rattlesnake Canyon Grocery", "2817 Milton Dr.", "USA"));
//cust.Add(new Customer("REGGC", "Maurizio Moroni", "Reggiani Caseifici", "Strada Provinciale 124", "Italy"));
//cust.Add(new Customer("RICAR", "Janete Limeira", "Ricardo Adocicados", "Av. Copacabana, 267", "Brazil"));
//cust.Add(new Customer("RICSU", "Michael Holz", "Richter Supermarkt", "Grenzacherweg 237", "Switzerland"));
//cust.Add(new Customer("ROMEY", "Alejandra Camino", "Romero y tomillo", "Gran Vía, 1", "Spain"));
//cust.Add(new Customer("SANTG", "Jonas Bergulfsen", "Santé Gourmet", "Erling Skakkes gate 78", "Norway"));
//cust.Add(new Customer("SAVEA", "Jose Pavarotti", "Save-a-lot Markets", "187 Suffolk Ln.", "USA"));
//cust.Add(new Customer("SEVES", "Hari Kumar", "Seven Seas Imports", "90 Wadhurst Rd.", "UK"));
//cust.Add(new Customer("SIMOB", "Jytte Petersen", "Simons bistro", "Vinbæltet 34", "Denmark"));
//cust.Add(new Customer("SPECD", "Dominique Perrier", "Spécialités du monde", "25, rue Lauriston", "France"));
//cust.Add(new Customer("SPLIR", "Art Braunschweiger", "Split Rail Beer & Ale", "P.O. Box 555", "USA"));
//cust.Add(new Customer("SUPRD", "Pascale Cartrain", "Suprêmes délices", "Boulevard Tirou, 255", "Belgium"));
//cust.Add(new Customer("THEBI", "Liz Nixon", "The Big Cheese", "89 Jefferson Way Suite 2", "USA"));
//cust.Add(new Customer("THECR", "Liu Wong", "The Cracker Box", "55 Grizzly Peak Rd.", "USA"));
//cust.Add(new Customer("TOMSP", "Karin Josephs", "Toms Spezialitäten", "Luisenstr. 48", "Germany"));
//cust.Add(new Customer("TORTU", "Miguel Angel Paolino", "Tortuga Restaurante", "Avda. Azteca 123", "Mexico"));
//cust.Add(new Customer("TRADH", "Anabela Domingues", "Tradição Hipermercados", "Av. Inês de Castro, 414", "Brazil"));
//cust.Add(new Customer("TRAIH", "Helvetius Nagy", "Trail's Head Gourmet Provisioners", "722 DaVinci Blvd.", "USA"));
//cust.Add(new Customer("VAFFE", "Palle Ibsen", "Vaffeljernet", "Smagsloget 45", "Denmark"));
//cust.Add(new Customer("VICTE", "Mary Saveley", "Victuailles en stock", "2, rue du Commerce", "France"));
//cust.Add(new Customer("VINET", "Paul Henriot", "Vins et alcools Chevalier", "59 rue de l'Abbaye", "France"));
//cust.Add(new Customer("WANDK", "Rita Müller", "Die Wandernde Kuh", "Adenauerallee 900", "Germany"));
//cust.Add(new Customer("WARTH", "Pirkko Koskitalo", "Wartian Herkku", "Torikatu 38", "Finland"));
//cust.Add(new Customer("WELLI", "Paula Parente", "Wellington Importadora", "Rua do Mercado, 12", "Brazil"));
//cust.Add(new Customer("WHITC", "Karl Jablonski", "White Clover Markets", "305 - 14th Ave. S. Suite 3B", "USA"));
//cust.Add(new Customer("WILMK", "Matti Karttunen", "Wilman Kala", "Keskuskatu 45", "Finland"));
//cust.Add(new Customer("WOLZA", "Zbyszek Piestrzeniewicz", "Wolski Zajazd", "ul. Filtrowa 68", "Poland"));
return cust;
}
public string CustomerID { get; set; }
public string ContactName { get; set; }
public string CompanyName { get; set; }
public string Address { get; set; }
public string Country { get; set; }
}
public class EmployeeDetails
{
public EmployeeDetails()
{
}
public EmployeeDetails(string EmployeeID, string Name, string MailID, string PhoneNumber, string Designation, string ReportTo, string Location, string AssetKit , DateTime AssetKitDistribution, string EmployeeAvailability, string Team, DateTime DateOfJoining, string YearOfExperience, string SoftwareTeam)
{
this.EmployeeID = EmployeeID;
this.Name = Name;
this.MailID = MailID;
this.PhoneNumber = PhoneNumber;
this.Designation = Designation;
this.ReportTo = ReportTo;
this.Location = Location;
this.AssetKit = AssetKit;
this.AssetKitDistribution = AssetKitDistribution;
this.EmployeeAvailability = EmployeeAvailability;
this.Team = Team;
this.DateOfJoining = DateOfJoining;
this.YearOfExperience = YearOfExperience;
this.SoftwareTeam = SoftwareTeam;
}
public string EmployeeID { get; set; }
public string Name { get; set; }
public string MailID { get; set; }
public string PhoneNumber { get; set; }
public string Designation { get; set; }
public string ReportTo { get; set; }
public string Location { get; set; }
public string AssetKit { get; set; }
public DateTime AssetKitDistribution { get; set; }
public string EmployeeAvailability { get; set; }
public string Team { get; set; }
public DateTime DateOfJoining { get; set; }
public string YearOfExperience { get; set; }
public string SoftwareTeam { get; set; }
public static List<EmployeeDetails> GetAllRecords()
{
List<EmployeeDetails> Emp = new List<EmployeeDetails>();
Emp.Add(new EmployeeDetails("Emp1001", "John", "john@abc.com", "(711) 555-4444", "Sales Representative", "Vinet", "Reims", "Headset, Laptop, Phone", new DateTime(1948, 12, 08), "Available", "Sales", new DateTime(1948, 12, 08), "3 Years", "Web-General"));
Emp.Add(new EmployeeDetails("Emp1002", "Suyama", "suyama@abc.com", "(206) 555-1189", "Marketing Manager", "Suprd", "Albuquerque", "Laptop, Projector, Tablet", new DateTime(1952, 02, 19), "Available", "Marketing", new DateTime(1952, 02, 19), "1 Year 10 Months", "Web-Server"));
Emp.Add(new EmployeeDetails("Emp1003", "Janet", "janet@abc.com", "(710) 555-5598", "HR Specialist", "Hanar", "Barquisimeto", "Headset, Laptop, Printer", new DateTime(1963, 08, 30), "Not Available", "Human Resources", new DateTime(1963, 08, 30), "1 Year", "Web-General"));
Emp.Add(new EmployeeDetails("Emp1004", "Peacock", "peacock@abc.com", "(811) 555-7773", "Sales Representative", "Vinet", "Albuquerque", "Headset, Laptop, Phone", new DateTime(1937, 09, 19), "Available", "Sales", new DateTime(1937, 09, 19), "2 Years", "Window"));
Emp.Add(new EmployeeDetails("Emp1005", "Leverling", "leverling@abc.com", "(712) 555-4848", "IT Support", "Tomsp", "Reims", "Keyboard, Laptop, Mouse", new DateTime(1955, 03, 04), "Not Available", "IT Department", new DateTime(1955, 03, 04), "5 Years 3 Months", "Web-Server"));
Emp.Add(new EmployeeDetails("Emp1006", "Fuller", "fuller@abc.com", "(206) 555-8122", "HR Specialist", "Victe", "Barquisimeto", "Headset, Laptop, Printer", new DateTime(1963, 07, 02), "Available", "Human Resources", new DateTime(1963, 07, 02), "3 Years 1 Month", "Designer"));
Emp.Add(new EmployeeDetails("Emp1007", "Buchanan", "buchanan@abc.com", "(206) 555-3412", "Marketing Manager", "Hanar", "Reims", "Laptop, Projector, Tablet", new DateTime(1960, 05, 29), "Not Available", "Marketing", new DateTime(1960, 05, 29), "4 Years", "Support"));
Emp.Add(new EmployeeDetails("Emp1008", "Davolio", "davolio@abc.com", "(206) 555-9482", "Customer Service", "Vinet", "Albuquerque", "Headset, Laptop, Phone", new DateTime(1958, 01, 09), "Not Available", "Customer Support", new DateTime(1958, 01, 09), "11 Months", "Web-Server"));
Emp.Add(new EmployeeDetails("Emp1009", "Robert", "robert@abc.com", "(206) 555-9857", "Finance Analyst", "Suprd", "Reims", "Calculator, Headset, Laptop", new DateTime(1966, 01, 27), "Available", "Finance", new DateTime(1966, 01, 27), "3 Years 5 Months", "Testing"));
return Emp;
}
}
}
}
@* Install once: Install-Package Lumen.UI.Mvc (or: dotnet add package Lumen.UI.Mvc) *@
@* Views/Web.config: <add namespace="Lumen.UI.Mvc" /> *@
@* Views/Shared/_Layout.cshtml *@
<head>
@Html.UiStyles()
<link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
@RenderBody()
@Html.UiScripts()
@RenderSection("scripts", required: false)
</body>
@* Grids with a DataUrl: @Html.AntiForgeryToken() on the page and [HttpPost, ValidateJsonAntiForgeryToken] on the action. *@
The Grid creates a custom layout for each cell using the column template feature. The columns->template property accepts either string or HTML element`s ID value, which will be used as the template for the cell.
The column template feature allows the customization of grid cells. In this demo, the Grid showcases the Employee Image column with employee photos, Mail ID column with link tags, Location column with location icons, Asset Kit column with Syncfusion Chip components and Employee Availability column with HTML span elements, using green to indicate available and red to indicate for not available.
The template expression should be provided inside ${...} interpolation syntax.