Skip to main content

GridViewSettings.SummaryDisplayText Property

Enables custom display text to be provided for any summary value.

Namespace: DevExpress.Web.Mvc

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

Declaration

public ASPxGridViewSummaryDisplayTextEventHandler SummaryDisplayText { get; set; }

Property Value

Type Description
ASPxGridViewSummaryDisplayTextEventHandler

An ASPxGridViewSummaryDisplayTextEventHandler delegate method allowing you to implement custom processing.

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