Back to Devexpress

ASPxGridView.GroupSummary Property

aspnet-devexpress-dot-web-dot-aspxgridview-bf9e1ee5.md

latest6.1 KB
Original Source

ASPxGridView.GroupSummary Property

Provides access to group summary items.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(null)]
public ASPxSummaryItemCollection GroupSummary { get; }
vb
<DefaultValue(Nothing)>
Public ReadOnly Property GroupSummary As ASPxSummaryItemCollection

Property Value

TypeDefaultDescription
ASPxSummaryItemCollectionnull

An ASPxSummaryItemCollection object that represents the collection of group summary items.

|

Remarks

Group summaries are displayed within group rows when data grouping is applied. Summary items are represented by the ASPxSummaryItem 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 server mode, summary cannot be calculated for unbound columns whose values calculated via events (see ASPxGridView.CustomUnboundColumnData). Only columns with unbound expressions (see GridViewDataColumn.UnboundExpression) support summary calculation.

Concept

Data Summaries

Example

In code:

csharp
ASPxSummaryItem groupSummary = new ASPxSummaryItem();
groupSummary.FieldName = "Budget";
groupSummary.SummaryType = SummaryItemType.Max;
ASPxGridView1.GroupSummary.Add(groupSummary);
vb
Dim groupSummary As ASPxSummaryItem = New ASPxSummaryItem()
groupSummary.FieldName = "Budget"
groupSummary.SummaryType = SummaryItemType.Max
ASPxGridView1.GroupSummary.Add(groupSummary)

In markup:

aspx
<dx:ASPxGridView ID="ASPxGridView1" runat="server" ...>
    <!-- ... -->
    <GroupSummary>
        <dx:ASPxSummaryItem FieldName="UnitPrice" ShowInGroupFooterColumn="UnitPrice"
            SummaryType="Count" />
    </GroupSummary>
</dx:ASPxGridView>

Online Example

View Example: How to use group footer and footer templates to customize group and total summaries

The following code snippets (auto-collected from DevExpress Examples) contain references to the GroupSummary property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

xaf-how-to-extend-the-application-model/CS/ExtendModel.Module.Web/Controllers/WebGroupFooterViewController.cs#L24

csharp
ASPxSummaryItem summaryItem = null;
foreach (ASPxSummaryItem currentItem in gridView.GroupSummary) {
    if (currentItem.FieldName == fieldName) {

asp-net-web-forms-grid-create-report-based-on-grid-layout/CS/WebApplication1/ReportHelper.cs#L63

csharp
footerBand.BackColor = Color.LightGray;
foreach(ASPxSummaryItem item in aspxGridView1.GroupSummary) {
    GridViewColumn col = aspxGridView1.Columns[item.FieldName];

xaf-how-to-extend-the-application-model/VB/ExtendModel.Module.Web/Controllers/WebGroupFooterViewController.vb#L25

vb
Dim summaryItem As ASPxSummaryItem = Nothing
For Each currentItem As ASPxSummaryItem In gridView.GroupSummary
    If currentItem.FieldName = fieldName Then

asp-net-web-forms-grid-create-report-based-on-grid-layout/VB/WebApplication1/ReportHelper.vb#L65

vb
footerBand.BackColor = Color.LightGray
For Each item As ASPxSummaryItem In aspxGridView1.GroupSummary
    Dim col As GridViewColumn = aspxGridView1.Columns(item.FieldName)

See Also

TotalSummary

GetGroupRowSummaryText(Int32)

GetGroupSummaryValue(Int32, ASPxSummaryItem)

CustomSummaryCalculate

Grid View

ASPxGridView Class

ASPxGridView Members

DevExpress.Web Namespace