Adding totals

Docs

Aggregates can be added for a column using the Aggregate column method. An aggregate can be Sum, Avg, Min, Max or Count.

Razor
                                
                                        
DbNetGridCore orderTotalsGrid = new DbNetGridCore("northwind", "Customers join Orders on Customers.CustomerID = Orders.CustomerID join [Order Details] on Orders.OrderID = [Order Details].OrderID");
orderTotalsGrid.Columns = new List() { "Customers.CompanyName", "Orders.OrderDate", "[Order Details].OrderID", "[Order Details].ProductID", "[Order Details].UnitPrice", "[Order Details].Quantity", "(UnitPrice*Quantity) as Value" };
orderTotalsGrid.Labels = new List() { "Company Name", "Order Date", "Order ID", "Product", "Unit Price", "Qty", "Value" };
orderTotalsGrid.Column(new string[] { "UnitPrice", "value" }).Format("c");
orderTotalsGrid.Column("OrderDate").Format("MMMM yyyy");
orderTotalsGrid.Column("value").DataType(typeof(Decimal)).Aggregate(AggregateType.Sum);
orderTotalsGrid.Column("ProductID").Lookup(new Lookup("Products", "ProductId", "ProductName"));
@orderTotalsGrid.Render()