Back to Devexpress

GridViewSettings.SummaryDisplayText Property

aspnetmvc-devexpress-dot-web-dot-mvc-dot-gridviewsettings-ebdb82d8.md

latest2.4 KB
Original Source

GridViewSettings.SummaryDisplayText Property

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

Namespace : DevExpress.Web.Mvc

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

NuGet Package : DevExpress.Web.Mvc5

Declaration

csharp
public ASPxGridViewSummaryDisplayTextEventHandler SummaryDisplayText { get; set; }
vb
Public Property SummaryDisplayText As ASPxGridViewSummaryDisplayTextEventHandler

Property Value

TypeDescription
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.

aspx
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

Declaring Server-Side Event Handlers

Grid View

GridViewSettings Class

GridViewSettings Members

DevExpress.Web.Mvc Namespace