Back to Devexpress

Obtain Summary Values

aspnet-5155-components-grid-view-concepts-use-data-summaries-obtain-summary-values.md

latest2.4 KB
Original Source

Obtain Summary Values

  • May 15, 2023

ASPxGridView supports two types of summaries: Total Summary and Group Summary. This topic explains how to obtain summary values in code.

Obtain Total Summary Value

ASPxGridView stores its total summary items within the ASPxGridView.TotalSummary collection. To obtain the required summary item’s value, use the ASPxGridView.GetTotalSummaryValue method.

csharp
int siValue = Convert.ToInt32(ASPxGridView1.GetTotalSummaryValue(
         ASPxGridView1.TotalSummary["UnitPrice", DevExpress.Data.SummaryItemType.Max]));

Use the ASPxSummaryItem.GetTotalFooterDisplayText method to obtain the total summary item’s display text.

Obtain Group Summary Value

Group summary items are stored within the ASPxGridView.GroupSummary collection. Use the ASPxGridView.GetGroupSummaryValue method to obtain the required summary item’s value calculated against the specified group of rows.

csharp
int gsiValue = Convert.ToInt32(ASPxGridView1.GetGroupSummaryValue(0, ASPxGridView1.
GroupSummary["Discontinued", DevExpress.Data.SummaryItemType.Count]));
vb
Dim gsiValue As Integer = Convert.ToInt32(ASPxGridView1.GetGroupSummaryValue_
(0, ASPxGridView1.GroupSummary("Discontinued", DevExpress.Data.SummaryItemType.Count)))

To get the summary text displayed within the specified group row, use the ASPxGridView.GetGroupRowSummaryText method.

See Also

Code Example T114923: ASPxGridView - How to update total summaries on the client side in Batch Edit mode