aspnet-devexpress-dot-web-dot-aspxgridview-196d53bc.md
Provides access to total summary items.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
[DefaultValue(null)]
public ASPxSummaryItemCollection TotalSummary { get; }
<DefaultValue(Nothing)>
Public ReadOnly Property TotalSummary As ASPxSummaryItemCollection
| Type | Default | Description |
|---|---|---|
| ASPxSummaryItemCollection | null |
An ASPxSummaryItemCollection object that is the collection of summary items.
|
Total summaries are displayed within footer cells provided that the ASPxGridViewSettings.ShowFooter option is set to true. The total summary represents a value of an aggregate function calculated over all data rows displayed within the ASPxGridView.
Note
In server mode, a summary cannot be calculated for unbound columns whose values are calculated via events (see ASPxGridView.CustomUnboundColumnData). Only columns with unbound expressions (see GridViewDataColumn.UnboundExpression) support summary calculation.
To learn more, see Data Summaries.
View Example: How to use group footer and footer templates to customize group and total summaries
This example calculates the average budget and displays it within the ASPxGridView’s footer.
protected void Page_Load(object sender, EventArgs e) {
ASPxSummaryItem totalSummary = new ASPxSummaryItem();
totalSummary.FieldName = "Budget";
totalSummary.ShowInColumn = "Budget";
totalSummary.SummaryType = SummaryItemType.Average;
ASPxGridView1.TotalSummary.Add(totalSummary);
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim totalSummary As ASPxSummaryItem = New ASPxSummaryItem()
totalSummary.FieldName = "Budget"
totalSummary.ShowInColumn = "Budget"
totalSummary.SummaryType = SummaryItemType.Average
ASPxGridView1.TotalSummary.Add(totalSummary)
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the TotalSummary 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.
asp-net-mvc-grid-create-report-based-on-grid-layout/CS/E4755/Models/MVCxGridViewState.cs#L14
TotalSummary = new System.Collections.ObjectModel.Collection<MVCxSummaryItemState>();
foreach (ASPxSummaryItem item in gridView.TotalSummary) {
TotalSummary.Add(new MVCxSummaryItemState(item));
asp-net-web-forms-grid-create-report-based-on-grid-layout/CS/WebApplication1/ReportHelper.cs#L85
report.Bands.Add(new ReportFooterBand() { HeightF = bandHeight });
foreach(ASPxSummaryItem item in aspxGridView1.TotalSummary) {
GridViewColumn col = aspxGridView1.Columns[item.ShowInColumn == string.Empty ? item.FieldName : item.ShowInColumn];
asp-net-mvc-grid-create-report-based-on-grid-layout/VB/E4755/Models/MVCxGridViewState.vb#L71
TotalSummary = New System.Collections.ObjectModel.Collection(Of MVCxSummaryItemState)()
For Each item As ASPxSummaryItem In gridView.TotalSummary
TotalSummary.Add(New MVCxSummaryItemState(item))
asp-net-web-forms-grid-create-report-based-on-grid-layout/VB/WebApplication1/ReportHelper.vb#L87
report.Bands.Add(New ReportFooterBand() With {.HeightF = bandHeight})
For Each item As ASPxSummaryItem In aspxGridView1.TotalSummary
Dim col As GridViewColumn = aspxGridView1.Columns(If(item.ShowInColumn = String.Empty, item.FieldName, item.ShowInColumn))
See Also
GetTotalSummaryValue(ASPxSummaryItem)