Skip to main content
Tab

ASPxGridView.GetTotalSummaryValue(ASPxSummaryItem) Method

Returns a summary value calculated against all data rows.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

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 allows 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.

Online Example

View Example: How to use group footer and footer templates to customize group and total summaries

Example

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

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;
        }

    }
}
See Also