The GroupHeader column property allows you select one or more columns to be used to separate groups of rows based on the change in value of any of the specified columns.
Orders
Customers
Razor
DbNetGridCore ordersGrid = new DbNetGridCore("northwind", "orders", "ordersGrid")
{
Columns = new List() { "OrderID", "CustomerID", "EmployeeID", "OrderDate", "RequiredDate", "ShippedDate", "ShipVia", "Freight" },
PageSize = 10
};
ordersGrid.SetColumnProperty("CustomerID", ColumnPropertyType.GroupHeader, true);
ordersGrid.SetColumnProperty("EmployeeID", ColumnPropertyType.Lookup, new Lookup("Employees", "EmployeeId", "lastname + ',' + firstname"));
ordersGrid.SetColumnProperty("CustomerID", ColumnPropertyType.Lookup, new Lookup("Customers", "CustomerId", "CompanyName"));
ordersGrid.SetColumnProperty("ShipVia", ColumnPropertyType.Lookup, new Lookup("Shippers", "ShipperId", "CompanyName"));
@ordersGrid.Render()
DbNetGridCore customersGrid = new DbNetGridCore("northwind", "customers", "customersGrid")
{
Columns = new List() { "ContactName", "ContactTitle", "Address", "Region", "PostalCode", "Phone", "Fax", "Country", "City" },
PageSize = 10
};
customersGrid.SetColumnProperty(new String[] { "Country", "City" }, ColumnPropertyType.GroupHeader, true);
@customersGrid.Render()