Skip to main content

GridViewSettings.CustomSummaryCalculate Property

Enables you to calculate summary values manually.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v23.2.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public CustomSummaryEventHandler CustomSummaryCalculate { get; set; }

Property Value

Type Description
CustomSummaryEventHandler

A CustomSummaryEventHandler delegate method allowing you to implement custom processing.

Remarks

Note

The custom summary calculation option is not available in server mode. Please refer to the Binding to Large Data (Database Server Mode) help topic for more information.

Example

settings.CustomSummaryCalculate = (s, e) => {
    ASPxSummaryItem summary = e.Item as ASPxSummaryItem;
    MVCxGridView gridView = s as MVCxGridView;
    if (summary.FieldName != "TotalAmount")
        return;
    if (e.IsGroupSummary) {
        decimal totalValue;
        if (e.SummaryProcess == Start) {
            totalValue = 0;
        } else if (e.SummaryProcess == Calculate) {
            bool isCancelled = (bool)e.GetValue("isCancelled");
            if (!isCancelled) {
                totalValue += (int)e.FieldValue;
            }
        }
        else if (e.SummaryProcess == Finalize) {
            e.TotalValue = totalValue;
            e.TotalValueReady = true;
        }
    }
}
See Also