Edit this page

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="http://demos.telerik.com/aspnet-ajax/Services/SampleODataService.svc/Products" />
        <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"
Is this article helpful? No Yes
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article