aspnet-devexpress-dot-web-dot-aspxsummaryitemcollection-dot-add-x28-devexpress-dot-data-dot-summaryitemtype-system-dot-string-x29.md
Adds a new summary item with the specified settings to the collection.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public ASPxSummaryItem Add(
SummaryItemType summaryType,
string fieldName
)
Public Function Add(
summaryType As SummaryItemType,
fieldName As String
) As ASPxSummaryItem
| Name | Type | Description |
|---|---|---|
| summaryType | SummaryItemType |
A SummaryItemType enumeration value that specifies the aggregate function type. This value is assigned to the ASPxSummaryItemBase.SummaryType property.
| | fieldName | String |
A String value that specifies the name of the data source field whose values are used for summary calculation. This value is assigned to the ASPxSummaryItemBase.FieldName property.
|
| Type | Description |
|---|---|
| ASPxSummaryItem |
An ASPxSummaryItem object that represents the new summary item.
|
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
See Also
ASPxSummaryItemCollection Class