Back to Devexpress

TreeListSummaryItem.SummaryType Property

aspnet-devexpress-dot-web-dot-aspxtreelist-dot-treelistsummaryitem.md

latest3.5 KB
Original Source

TreeListSummaryItem.SummaryType Property

Gets or sets the aggregate function type.

Namespace : DevExpress.Web.ASPxTreeList

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

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(SummaryItemType.None)]
public SummaryItemType SummaryType { get; set; }
vb
<DefaultValue(SummaryItemType.None)>
Public Property SummaryType As SummaryItemType

Property Value

TypeDefaultDescription
SummaryItemTypeNone

A SummaryItemType enumeration value that specifies the aggregate function type.

|

Available values:

NameDescription
Sum

The sum of all values in a column.

| | Min |

The minimum value in a column.

| | Max |

The maximum value in a column.

| | Count |

The record count.

| | Average |

The average value of a column.

| | Custom |

Specifies whether calculations should be performed manually using a specially designed event.

| | None |

Disables summary value calculation.

|

Remarks

There are five predefined aggregate functions. These are: Sum , Min , Max , Average and Count. To implement your own aggregate function, set the SummaryType property to SummaryItemType.Custom, and handle the ASPxTreeList.CustomSummaryCalculate event.

Example

This example shows how to create data summaries in code. To display group summaries, enable the TreeListSettings.ShowGroupFooter option. To show total summaries, turn on the TreeListSettings.ShowFooter option. The image below shows the result:

csharp
using DevExpress.Web.ASPxTreeList;

protected void Page_Load(object sender, EventArgs e) {
    if (!IsPostBack) {
        TreeListSummaryItem siBudget = new TreeListSummaryItem();
        siBudget.FieldName = "BUDGET";
        siBudget.ShowInColumn = "BUDGET";
        siBudget.SummaryType = DevExpress.Data.SummaryItemType.Min;
        siBudget.DisplayFormat = "{0:c2}";
        ASPxTreeList1.Summary.Add(siBudget);
    }
}
vb
Imports DevExpress.Web.ASPxTreeList

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
   If (Not IsPostBack) Then
      Dim siBudget As TreeListSummaryItem = New TreeListSummaryItem()
      siBudget.FieldName = "BUDGET"
      siBudget.ShowInColumn = "BUDGET"
      siBudget.SummaryType = DevExpress.Data.SummaryItemType.Min
      siBudget.DisplayFormat = "{0:c2}"
      ASPxTreeList1.Summary.Add(siBudget)
   End If
End Sub

See Also

Tree List

TreeListSummaryItem Class

TreeListSummaryItem Members

DevExpress.Web.ASPxTreeList Namespace