Back to Devexpress

ASPxGridViewSummaryDisplayTextEventArgs.IsGroupSummary Property

aspnet-devexpress-dot-web-dot-aspxgridviewsummarydisplaytexteventargs-a3c7374a.md

latest3.1 KB
Original Source

ASPxGridViewSummaryDisplayTextEventArgs.IsGroupSummary Property

Indicates whether a group summary value is processed.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public bool IsGroupSummary { get; }
vb
Public ReadOnly Property IsGroupSummary As Boolean

Property Value

TypeDescription
Boolean

true if a group summary value is processed; otherwise, false.

|

Remarks

If the IsGroupSummary property returns true, use the ASPxGridViewSummaryDisplayTextEventArgs.VisibleIndex property to identify the group row where the processed group summary value is displayed.

Example

The following example illustrates how to use the IsGroupSummary property.

Web Forms approach:

csharp
protected void ASPxGridView1_SummaryDisplayText(object sender, DevExpress.Web.ASPxGridViewSummaryDisplayTextEventArgs e) {
    if (e.IsGroupSummary) {
        if (e.Item.FieldName == "UnitsOnOrder") {
            var val = TimeSpan.FromSeconds((int)e.Value);
            e.Text = string.Format("{0:c}", val);
        }
    }
}
vb
Protected Sub ASPxGridView1_SummaryDisplayText(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridViewSummaryDisplayTextEventArgs)
    If e.IsGroupSummary Then
        If e.Item.FieldName = "UnitsOnOrder" Then
            Dim val = TimeSpan.FromSeconds(CInt(Math.Truncate(e.Value)))
            e.Text = String.Format("{0:c}", val)
        End If
    End If
End Sub

MVC approach:

cshtml
var grid = Html.DevExpress().GridView(settings =>
{
    settings.Name = "GridView";
    settings.KeyFieldName = "ID";
    ...
    settings.GroupSummary.Add(DevExpress.Data.SummaryItemType.Count, "TestField").ShowInGroupFooterColumn = "TestField";
    settings.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "NumberField").ShowInGroupFooterColumn = "NumberField";
    settings.SummaryDisplayText = (s, e) => {
        if (e.IsGroupSummary)
            if (e.Item.FieldName == "TestField")
                e.Text = "TestText";
    };
});
}
...

See Also

IsTotalSummary

ASPxGridViewSummaryDisplayTextEventArgs Class

ASPxGridViewSummaryDisplayTextEventArgs Members

DevExpress.Web Namespace