Skip to main content

GridViewSettings.GroupSummary Property

Provides access to group summary items.

Namespace: DevExpress.Web.Mvc

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

NuGet Package: DevExpress.Web.Mvc5

Declaration

public ASPxSummaryItemCollection GroupSummary { get; }

Property Value

Type Description
ASPxSummaryItemCollection

AnASPxSummaryItemCollection object representing the group summary collection.

Remarks

Group summaries are displayed within group rows when data grouping is applied. Summary items are represented by the ASPxSummaryItemCollection objects and are stored within the GroupSummary collection. This collection provides methods and properties that allow you to add, remove and access summary items.

Note

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

Example

This sample demonstrates how to use the GridViewSettings.SummaryDisplayText delegate method to define custom texts for group and total summaries displayed within the GridView.

GridViewSettings.SummaryDisplayText

Html.DevExpress().GridView(settings => {
    settings.Name = "dxGridView";
    ...
    settings.GroupSummary.Add(DevExpress.Data.SummaryItemType.Count, "ShipName");
    settings.TotalSummary.Add(DevExpress.Data.SummaryItemType.Sum, "UnitPrice").DisplayFormat = "c";
    settings.SummaryDisplayText = (sender, e) => {
        if(e.Item.FieldName == "UnitPrice")
            e.Text = string.Format("Sum of unit price: ${0}", Convert.ToDouble(e.Value));
        if(e.Item.FieldName == "ShipName")
            e.Text = string.Format("Count of records: {0}", Convert.ToDouble(e.Value));
    };
}).Bind(Model).Render();
See Also