Skip to main content
A newer version of this page is available. .
Tab

ASPxGridView.GetTotalSummaryValue(ASPxSummaryItem) Method

Returns a summary value calculated against all data rows.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

public object GetTotalSummaryValue(
    ASPxSummaryItem item
)

Parameters

Name Type Description
item ASPxSummaryItem

An ASPxSummaryItem object that represents the summary item.

Returns

Type Description
Object

An object which represents the summary value.

Remarks

The ASPxGridView enables you to calculate summaries which are aggregate functions based on values of data source fields. There are two predefined summary types: the total and group summaries. The total summary calculates an aggregate function by all rows and displays the result in a column’s footer. The group summary calculates an aggregate function for each group of rows and displays the result in a group row. Both summary types are represented by a ASPxSummaryItem object.

Example

This sample illustrates how to calculate the total summary value based on values of other summaries

View Example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxGridView;

namespace WebApplication11 {
    public partial class _Default : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
        }

        protected void ASPxGridView1_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) {
            ASPxSummaryItem incomeSummary = (sender as ASPxGridView).TotalSummary["Income"];
            ASPxSummaryItem expenseSummary = (sender as ASPxGridView).TotalSummary["Expense"];
            Decimal income = Convert.ToDecimal(((ASPxGridView)sender).GetTotalSummaryValue(incomeSummary));
            Decimal expense = Convert.ToDecimal(((ASPxGridView)sender).GetTotalSummaryValue(expenseSummary));
            e.TotalValue = income - expense;
        }

    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetTotalSummaryValue(ASPxSummaryItem) method.

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.

See Also