Back to Devexpress

TreeListCustomSummaryEventArgs Class

aspnet-devexpress-dot-web-dot-aspxtreelist-9b8f10b3.md

latest4.5 KB
Original Source

TreeListCustomSummaryEventArgs Class

Provides data for the ASPxTreeList.CustomSummaryCalculate event.

Namespace : DevExpress.Web.ASPxTreeList

Assembly : DevExpress.Web.ASPxTreeList.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public class TreeListCustomSummaryEventArgs :
    TreeListNodeEventArgs
vb
Public Class TreeListCustomSummaryEventArgs
    Inherits TreeListNodeEventArgs

TreeListCustomSummaryEventArgs is the data class for the following events:

Remarks

Summary values can be calculated manually within the ASPxTreeList.CustomSummaryCalculate event handler which fires for each node displayed within the ASPxTreeList. Additionally, this event is raised before and after processing nodes.

The TreeListCustomSummaryEventArgs class provides data for the ASPxTreeList.CustomSummaryCalculate event. The TreeListCustomSummaryEventArgs.SummaryProcess property identifies whether initialization, finalization or summary value calculation should be performed. A summary value that accumulates the custom calculated value is specified by the TreeListCustomSummaryEventArgs.Value property.

TreeListCustomSummaryEventArgs objects are automatically created and passed to the ASPxTreeList.CustomSummaryCalculate event handlers.

Example

This example shows how to implement a custom summary calculation.

Create a summary item within the ASPxTreeList.Summary collection and customize its settings as shown below:

The ASPxTreeList.CustomSummaryCalculate event is handled to sum the budgets of selected departments. Finally, set the TreeListSettingsBehavior.ProcessSelectionChangedOnServer option to true.

The image below shows the result:

csharp
using DevExpress.Data;

protected void ASPxTreeList2_CustomSummaryCalculate(object sender,
TreeListCustomSummaryEventArgs e) {
    switch (e.SummaryProcess) {
        case CustomSummaryProcess.Start:
            e.Value = (int)0;
            break;
        case CustomSummaryProcess.Calculate:
            if (e.Node.Selected)
                e.Value = (int)e.Value + (int)e.Node["Budget"];
            break;
        case CustomSummaryProcess.Finalize:
            break;
    }
}
vb
Imports DevExpress.Data

Protected Sub ASPxTreeList2_CustomSummaryCalculate(ByVal sender As Object,_
ByVal e As TreeListCustomSummaryEventArgs)
   Select Case e.SummaryProcess
      Case CustomSummaryProcess.Start
         e.Value = CInt(Fix(0))
      Case CustomSummaryProcess.Calculate
         If e.Node.Selected Then
            e.Value = CInt(Fix(e.Value)) + CInt(Fix(e.Node("Budget")))
         End If
      Case CustomSummaryProcess.Finalize
   End Select
End Sub

Inheritance

Object EventArgs TreeListNodeEventArgs TreeListCustomSummaryEventArgs

See Also

TreeListCustomSummaryEventArgs Members

Tree List

DevExpress.Web.ASPxTreeList Namespace