Linking to grids in another page |
Column values can be formatted using the Format property either standard C# date/numeric format strings or as this example a string template to create a button hyperlink from a value. The created button passes the CustomerID to a detail page where is used to display orders for that customer |
Loading...
Razor code
GridModel customerGrid = new GridModel(DataSourceType.SQLite, "northwind", "Customers");
customerGrid.Columns = new List<GridColumn>()
{
new GridColumn("CompanyName"),
new GridColumn("Address"),
new GridColumn("City"),
new GridColumn("Country"),
new GridColumn("Phone"),
new GridColumn("Fax"),
new GridColumn("CustomerID", "") {Format = "<a target='_blank' href='/samples/grid/detail?customerid={0}'><button type=\"button\" class=\"btn btn-secondary btn-sm\">Orders</button></a>"}
};
@(await new DbNetSuiteCore.GridControl(HttpContext).Render(customerGrid))