Telerik blogs

Have you ever dreamed of having the slick and flexible client-side performance in a traditional server-side data bound app? Now we make it a reality.

The R1 2016 release of the Telerik UI for ASP.NET AJAX suite adds an amazing improvement to the RadClientDataSource control.

Now you can hook it up directly to any server-side data source control and it will retrieve data and perform all necessary operations as if the control is using client-side databinding, significantly boosting performance and providing smooth user experience. And all this with just a few easy steps.

Read more below to find how to achieve this.

New Key Feature

The RadClientDataSource has been our main component serving as a provider for client-side capabilities to many of our controls, supporting binding to all kinds of web services. Now we further extend this feature by adding an option to extract data directly from a server-side data source control. No matter if you are using SqlDataSource, EntityDataSource or any other type—the RadClientDataSource can easily bind to any of them and retrieve data seamlessly.

It is a two way integration so performing an operation through the RadClientDataSource will also be immediately reflected on the server as well.


RadClientDataSource

The Setup

The configuration is pretty straightforward and easy. All settings of the new feature are conveniently placed in a new group called DataSourceControlSettings, which contains the following properties:

  • DataSourceID—sets or gets the ID of the server-side DataSource control from which the ClientDataSource will retrieve data
  • DataKeyNames—holds the comma-separated values of the field name used in CRUD operations
  • DataFields—holds comma-separated values of the data field names that would be retrieved from the datasource
  • AllowAutomaticUpdates, AllowAutomaticInserts, AllowAutomaticDeletes—serve to enable CRUD operations in the DataSource control
  • DataMember—specifies the name of the view of the DataSource that will be used when binding

Some of the already existing properties (such as EnableServerFiltering, EnableServerPaging, EnableServersorting) are also applicable in this case. Their function is the same as before—specify whether the particular operation should be performed on the client on entirely on the server.

<telerik:RadClientDataSource runat="server"
    ID="RadClientDataSource1"
    AllowPaging="true"
    EnableServerFiltering="true"
    EnableServerPaging="true"
    EnableServerSorting="true">
    <DataSource>
        <DataSourceControlSettings
            DataSourceID="SqlDataSource1"
            DataKeyNames="CategoryID"
            DataFields="CategoryID,CategoryName"
            AllowAutomaticDeletes="true"
            AllowAutomaticUpdates="true"
            AllowAutomaticInserts="true">
        </DataSourceControlSettings>
    </DataSource>
    <Schema>
        <Model ID="CategoryID">
           <telerik:ClientDataSourceModelField FieldName="CategoryID" DataType="Number" />
           <telerik:ClientDataSourceModelField FieldName="CategoryName" DataType="String" />
           <telerik:ClientDataSourceModelField FieldName="Description" DataType="String" />
        </Model>
    </Schema>
</telerik:RadClientDataSource>

 

Behind the Scenes

The secret of the client-side performance capabilities lies within an internal callback request to the server, which returns only the necessary portion of data serialized as JSON back to the client. This allows the standard databinding mechanism of the RadClienDataSource to pick up from there and process the data as necessary, as if it was returned from a call to web service.

If you have enabled server-side operations the control will also send the necessary parameters for paging, filtering or sorting. This will be then passed to the server-side data source control to perform the query to the database. All this happening seamlessly while the user can continue to work with the application.

Unlock Further Optimizations

We believe this new key feature of RadClientDataSource can unlock even more options for optimizations in a classic server-side data bound application by utilizing capabilities only available to a client-side app until now. The simple and easy switch to RadClientDataSource will allow your users to feel the difference right away and enjoy working without unnecessary postbacks.

If this sounds exciting, wait to see what we are going to bring in the upcoming service pack. Along with things like an improved appearance and responsiveness, there'll be full support for CRUD batch operations: any data source, any app—fully client-side! Now, how cool is that?

Eager to try out the latest features? Our demos await you: ClientDataSource—Binding to DataSource Controls. Additional information can also be found in this help topic.

Let us know how you find the new feature of RadClientDataSource in the comments section below.


About the Author

Marin Georgiev

is a software developer in one of Telerik's ASP.NET AJAX Teams. Since he joined the company in 2010 he's been working on different client-side features and extending the mobile support of the controls. His interests include mobile and web development as well as integration with Sharepoint 2010.

Related Posts

Comments

Comments are disabled in preview mode.