ASPxSummaryItem Class
Represents a summary item.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
#Declaration
public class ASPxSummaryItem :
ASPxSummaryItemBase
#Related API Members
The following members return ASPxSummaryItem objects:
#Remarks
The ASPxGridView allows you to display brief information about groups of rows or individual data columns. For instance, you can display the number of records, or the maximum value, etc. This is called a summary. Summaries are represented by the ASPxSummaryItem objects.
The ASPxGridView supports two types of summaries:
-
These are aggregate function values calculated over all the rows within the ASPxGridView and displayed within the footer. Total summaries are stored within the ASPxGridView.TotalSummary collection.
-
The aggregate function value calculated over all rows within a group and displayed in the group row or group footer. Group summaries are stored within the ASPxGridView.GroupSummary collection.
For a summary item, the following two properties must be specified.
- The ASPxSummaryItemBase.FieldName property specifies the name of a data source field whose values are used for summary calculation.
- The ASPxSummaryItemBase.SummaryType property specifies the aggregate function type.
<dx:ASPxSummaryItem FieldName="Total" SummaryType="Sum"/>
The summary item above summarizes the ‘Total’ field values within a group and display the sum in the group row.
The ASPxSummaryItem provides the ASPxSummaryItem.ShowInColumn and ASPxSummaryItem.ShowInGroupFooterColumn properties allowing you to select where the summary is displayed.
To learn more, see Data Summaries.
#Example
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);
}