New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Aggregates

LocationIDLocationNamePopulationAreaDensity (Ppl/km2)
1
Page size:
1Asia3,879,000,000.0043,820,000.00 km288.00
2Africa922,011,000.0030,370,000.00 km230.00
3North America528,720,588.0024,490,000.00 km221.00
4South America382,000,000.0017,840,000.00 km221.00
 5Antarctica1,000.0013,720,000.00 km20.00
6Europe731,000,000.0010,180,000.00 km271.00
7Australia22,000,000.009,008,500.00 km22.00
 Count: 98Sum: 10,702,470,081.00Sum: 212,404,936.00 km2Average: 2,964.11

RadTreeList provides the possibility to display column aggregates. The calculated total values are displayed in the footer item at the end of each level. Below you can find a list of the available aggregate functions:

  • Avg
  • Count
  • CountDistinct
  • First
  • Last
  • Max
  • Min
  • Sum
  • DefaultCS.aspx
  • styles.css
<%@ Page Language="c#"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<div class="demo-container no-bg">
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
        <telerik:RadTreeList RenderMode="Lightweight" ID="RadTreeList1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false" ParentDataKeyNames="ParentLocationID" AllowPaging="true" PageSize="10" DataKeyNames="LocationID" AllowSorting="true" ShowFooter="true">
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
            <Columns>
                <telerik:TreeListBoundColumn DataField="LocationID" UniqueName="LocationID" HeaderText="LocationID">
                </telerik:TreeListBoundColumn>
                <telerik:TreeListBoundColumn DataField="LocationName" UniqueName="LocationName" HeaderText="LocationName" Aggregate="Count" FooterAggregateFormatString="Count: {0}">
                </telerik:TreeListBoundColumn>
                <telerik:TreeListNumericColumn DataField="Population" UniqueName="Population" HeaderText="Population" HeaderStyle-Width="200px" DataFormatString="{0:n}" Aggregate="Sum" DataType="System.Double" FooterAggregateFormatString="Sum: {0:n}">
                    <ItemStyle HorizontalAlign="Right"></ItemStyle>
                </telerik:TreeListNumericColumn>
                <telerik:TreeListNumericColumn DataField="Area" UniqueName="Area" HeaderText="Area" Aggregate="Sum" HeaderStyle-Width="200px" DataFormatString="{0:n} km<sup>2</sup>" DataType="System.Double" FooterAggregateFormatString="Sum: {0:n} km<sup>2</sup>">
                    <ItemStyle HorizontalAlign="Right"></ItemStyle>
                </telerik:TreeListNumericColumn>
                <telerik:TreeListCalculatedColumn DataFields="Area, Population" Expression="{1} / {0}" HeaderText="Density (Ppl/km<sup>2</sup>)" DataFormatString="{0:n}" Aggregate="Avg" FooterAggregateFormatString="Average: {0:n}">
                    <ItemStyle HorizontalAlign="Right"></ItemStyle>
                </telerik:TreeListCalculatedColumn>
                <telerik:TreeListBoundColumn DataField="ParentLocationID" UniqueName="ParentLocationID" Visible="false" HeaderText="ParentLocationID"></telerik:TreeListBoundColumn>
            </Columns>
        </telerik:RadTreeList>
    </telerik:RadAjaxPanel>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>" SelectCommand="SELECT [LocationID], [LocationName], [Population], [Area], [ParentLocationID] FROM [WorldLocations]"></asp:SqlDataSource>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance