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

ClientDataSource Object - aggregates()

Method to return the calculated aggregate values of the RadClientDataSource.

Method Returns Description
aggregates Object Returns the aggregate results. There is a key for every aggregated field.
<telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
        <WebServiceDataSourceSettings ServiceType="OData">
            <Select Url="" />
        <telerik:ClientDataSourceAggregate Field="ProductID" Aggregate="Count" />
        <telerik:ClientDataSourceAggregate Field="UnitPrice" Aggregate="Sum" />
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="buttonClick(); return false;" />
<script type="text/javascript">
    var dataSource;
    function pageLoad() {
        dataSource = $find('<%= RadClientDataSource1.ClientID %>');
    function buttonClick() {
        var aggregates = dataSource.aggregates();
        var count = aggregates.ProductID.count; // returns "12"
        var sum = aggregates.UnitPrice.sum; // returns "340.35"
In this article