1 I recently released the first two episodes of my new screencast series, RadTips. In these episodes I show users how to take advantage of the new client-side databinding feature of the RadGrid (only available in the Q2 2008 release of RadControls for ASP.NET). I wanted to highlight what we consider to be a best practice when using the RadGrid's client-side API to do your databinding, something I didn't do in either of the episodes.

While client-side databinding can save some bandwidth and improve round-trip speeds on subsequent requests, it is actually faster to to bind data to the RadGrid on the server during the initial request. The reason is that if you are binding exclusively on the client, the initial request will cost you two round-trips to the server: one to retrieve the page, then another to retrieve the data. If data is bound to the grid on the server during the initial request, you can eliminate the need for both trips.

This technique also comes with some other not-so-obvious advantages. When binding data on the server, the complete markup for the grid and its data is returned to the client. If this does not happen on the initial request, some markup may not be generated. One case in particular where this is a problem is with the RadGrid's pager. The default pager mode (NextPrev) works just fine, but if you want to use the Numeric mode, you will be out of luck. If the grid data is not bound on the server, the when the grid is constructed on the server there is no way to predict how many pages it will have, and thus only a single page is rendered. This problem can be avoided all-together if data is bound on the server during the initial request.

Check out this live demo. It features client-side databinding and paging with the RadGrid.

Source Code:  C#  VB


About the Author

Iana Tsolova

is Product Manager at Telerik’s DevTools division. She joined the company back in the beginning of 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of the ASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web development, reading articles related to geography, wild nature and latest renewable energy technologies.

Related Posts

Comments

Comments are disabled in preview mode.