<div id="Grid1"></div>
@using DbNetLink.DbNetSuite.UI
@{
    DbNetGrid Grid = new DbNetLink.DbNetSuite.UI.DbNetGrid();
    Grid.ID = "Grid1";
    Grid.ConnectionString = "SamplesDatabase";
    Grid.FromPart = "((customers inner join orders on orders.customerid = customers.customerid) inner join [order details] on [order details].orderid = orders.orderid)";
    Grid.UpdateRow = false;
    Grid.InsertRow = false;
    Grid.Theme = Themes.Bootstrap;
    Grid.PageSize = 10;

    GridColumn C = Grid.GridColumns.Add("Orders.CustomerID");
    C.Label = "Company";
    C.Lookup = "select CustomerID, CompanyName from customers";
    C.TotalBreak = true;
    C.ClearDuplicateValue = true;

    C = Grid.GridColumns.Add("Orders.OrderID");
    C.TotalBreak = true;
    C.ClearDuplicateValue = true;

    C = Grid.GridColumns.Add("[Order Details].ProductID");
    C.Lookup = "select productid, productname from products";

    C = Grid.GridColumns.Add("[Order Details].UnitPrice");
    C.Aggregate = DbNetLink.DbNetSuite.GridColumn.AggregateValues.Avg;
    C.Format = "C";

    C = Grid.GridColumns.Add("[Order Details].Quantity");
    C.Aggregate = DbNetLink.DbNetSuite.GridColumn.AggregateValues.Sum;

    C = Grid.GridColumns.Add("([Order Details].UnitPrice * [Order Details].Quantity) as OrderValue");
    C.Aggregate = DbNetLink.DbNetSuite.GridColumn.AggregateValues.Sum;
    C.Format = "C";
                                             
    @Html.Raw(MVC.Render(Grid));
}
;