Retrieve filtered data from RadClientDataSource using RadGrid's event

1 posts, 0 answers
  1. Attila Antal
    Attila Antal avatar
    575 posts

    Posted 17 Jan 2018 Link to this post


    Telerik Product and Version


    Supported Browsers and Platforms

    All browsers supported by Telerik UI for ASP .NET AJAX

    Components/Widgets used (JS frameworks, etc.)

    ASP.NET, JavaScript

    This sample describes the way to access the filtered results instead of the entire data when RadGrid is bound to RadClientDataSource. It could also be a viable workaround for the issue reported as Grid with RadClientDataSource sends two requests when navigating with Grid pager.

    Create a RadClientDataSource control and set its EnableServerFiltering property to True.
    <telerik:RadClientDataSource ID="RadClientDataSource1" runat="server" EnableServerFiltering="true">
            <WebServiceDataSourceSettings ServiceType="OData">
                <Select Url="" DataType="JSONP" />

    Create a RadGrid, set the ClientDataSourceID property's value to the ID of the RadClientDataSource created earlier and subscribe it to OnDataBound client event.
    <telerik:RadGrid ... ClientDataSourceID="RadClientDataSource1">
            <ClientEvents OnDataBound="gridBound" />

    JavaScript method to be executed when the OnDataBound event of RadGrid is fired.
    function gridBound(sender, args) {
        // access the DataSource object bound to grid
        var clientDataSource = $find(sender._clientDataSourceID);
        // Access the Kendo widget
        var widget = clientDataSource.get_kendoWidget();
        // Access the filtered data from the data source
        var result = widget._pristineData;
        // process the "result"

Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.