<div id="Grid1"></div>
@using DbNetLink.DbNetSuite.UI
@{
    DbNetGrid Grid = new DbNetGrid();
    Grid.ConnectionString = "SamplesDatabase";
    Grid.PageSize = 10;
    Grid.FromPart = "Products";
    Grid.ID = "Grid1";
    Grid.Theme = Themes.Bootstrap;
        
    Grid.ToolbarButtonStyle = DbNetLink.DbNetSuite.Shared.ToolButtonStyles.ImageAndText;

    string[] Columns = { "ProductID", "ProductName", "SupplierID", "CategoryID", "QuantityPerUnit", "UnitPrice", "UnitsInStock", "UnitsOnOrder", "ReorderLevel", "Discontinued" };
    
    foreach (String Column in Columns)
    {
        GridColumn C = Grid.GridColumns.Add(Column);

        if (Column != "ProductID") {
            C.InlineEdit = true;
        }
        
        switch(Column)
        {
            case "SupplierID":
                C.Lookup = "select SupplierId, CompanyName from Suppliers";
                break;
            case "CategoryID":
                C.Lookup = "select CategoryId, CategoryName from Categories";
                break;
            case "UnitPrice":
                C.Format = "C";
                break;                          
        }
    }
                                                      
    @Html.Raw(DbNetLink.DbNetSuite.UI.MVC.Render(Grid));
};