Skip to main content

GridViewSettings.TotalSummary Property

Provides access to total summary items.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public ASPxSummaryItemCollection TotalSummary { get; }

Property Value

Type Description
ASPxSummaryItemCollection

A ASPxSummaryItemCollection object representing the total summary collection.

Remarks

Use the TotalSummary property to access the collection of total summary items. Note that total summaries are displayed within the grid’s footer, so you need to enable the grid’s footer by setting the ASPxGridViewSettings.ShowFooter (via GridViewSettings.Settings.ShowFooter) property to true.

Note

In database server mode, a summary cannot be calculated for unbound columns in which values are calculated via delegate methods (see GridViewSettings.CustomUnboundColumnData). Only columns with unbound expressions (see GridViewDataColumn.UnboundExpression) support summary calculation.

Example

The code sample below demonstrates how to add a summary item to the TotalSummary collection.

@Html.DevExpress().GridView(settings => {
    settings.Name = "GridView";
    // ...
    settings.Columns.Add("CompanyName");
    settings.Columns.Add("ContactName");
    // ...
    // Adds a total summary of "Count" type in the "CompanyName" column.
    settings.TotalSummary.Add(DevExpress.Data.SummaryItemType.Count, "CompanyName");
    // Total summaries are displayed within the grid footer. So, the grid footer must be enabled. 
    settings.Settings.ShowFooter = true;
}).Bind(Model).GetHtml()
See Also