Back to Devexpress

How to: Display Summaries

aspnet-4016-components-tree-list-examples-how-to-display-summaries.md

latest1.4 KB
Original Source

How to: Display Summaries

  • Dec 17, 2020

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