Back to Devexpress

ASPxSummaryItemCollection.Add(SummaryItemType, String) Method

aspnet-devexpress-dot-web-dot-aspxsummaryitemcollection-dot-add-x28-devexpress-dot-data-dot-summaryitemtype-system-dot-string-x29.md

latest3.0 KB
Original Source

ASPxSummaryItemCollection.Add(SummaryItemType, String) Method

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

Declaration

csharp
public ASPxSummaryItem Add(
    SummaryItemType summaryType,
    string fieldName
)
vb
Public Function Add(
    summaryType As SummaryItemType,
    fieldName As String
) As ASPxSummaryItem

Parameters

NameTypeDescription
summaryTypeSummaryItemType

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.

|

Returns

TypeDescription
ASPxSummaryItem

An ASPxSummaryItem object that represents the new summary item.

|

Example

This example calculates the average budget and displays it within the ASPxGridView’s footer.

csharp
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);
}
vb
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

Remove(T)

Grid View

ASPxSummaryItemCollection Class

ASPxSummaryItemCollection Members

DevExpress.Web Namespace