Razor
DbNetGridCore customersGrid = new DbNetGridCore("northwind", "customers");
customersGrid.Columns = new List() { "CustomerID", "CompanyName", "Address", "City" };
customersGrid.Column("CustomerID").Hidden();
DbNetGridCore ordersGrid = new DbNetGridCore("northwind", "orders");
ordersGrid.ToolbarPosition = ToolbarPosition.Hidden;
ordersGrid.Columns = new List() { "OrderID", "CustomerID", "EmployeeID", "OrderDate", "RequiredDate", "ShippedDate", "ShipVia", "Freight", "ShipName", "ShipAddress", "ShipCity", "ShipRegion", "ShipPostalCode", "ShipCountry" };
ordersGrid.Column("CustomerID").ForeignKey().Hidden();
ordersGrid.Column("EmployeeID").Lookup(new Lookup("Employees", "EmployeeId", "lastname + ',' + firstname")).Label("Employee");
ordersGrid.Column("ShipVia").Lookup(new Lookup("Shippers", "ShipperId", "CompanyName"));
customersGrid.NestedGrid = ordersGrid;
DbNetGridCore orderDetailsGrid = new DbNetGridCore("northwind", "[order details]");
orderDetailsGrid.ToolbarPosition = ToolbarPosition.Hidden;
orderDetailsGrid.Columns = new List() { "OrderID", "ProductID", "Quantity", "UnitPrice" };
orderDetailsGrid.Column("OrderID").ForeignKey().Hidden();
orderDetailsGrid.Column("unitprice").Format("c");
orderDetailsGrid.Column("discount").Format("P");
orderDetailsGrid.Column("ProductID").Lookup(new Lookup("Products", "ProductId", "ProductName")).Label("Product");
ordersGrid.NestedGrid = orderDetailsGrid;
@customersGrid.Render()