aspnet-devexpress-dot-web-dot-mvc-dot-gridviewsettings-09929852.md
Enables you to calculate summary values manually.
Namespace : DevExpress.Web.Mvc
Assembly : DevExpress.Web.Mvc5.v20.1.dll
NuGet Package : DevExpress.Web.Mvc5
public CustomSummaryEventHandler CustomSummaryCalculate { get; set; }
Public Property CustomSummaryCalculate As CustomSummaryEventHandler
| Type | Description |
|---|---|
| CustomSummaryEventHandler |
A CustomSummaryEventHandler delegate method allowing you to implement custom processing.
|
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.
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