views:

734

answers:

3

How costly is databinding a collection of objects to a grid (telerik gridview to be specific) vs a regular datatable,

I wouldnt have thought it was an issue but I am doing the databinding via a webservice AJAX callback and if the grid has more than 20 rows it starts to take a noticable time to bind,

A: 

Even though it's limited to WinForms, take a look at BindingListView. It's faster than using a DataView/Table. Since you're using ASP.NET, I doubt you can use it directly, but it shouldn't be too hard to rewrite something similar in JavaScript, especially since it's open source.

Chris Doggett
A: 

How big are these objects that you are binding to? If these objects are large and contain data that is not pertinent to the control to which you will bind them too then you have overhead.

In other words if you have an object that has 30 properties and you are only using 2 of them to bind to the control you will see performance problems. I assume that the DataTable is faster because it only contains the data you need. Otherwise there is no reason that one would be significantly faster than the other for the same number of fields/properties.

Andrew Hare
No the object in question only has around 7 properties, most (if not all) of which are used in the binding.I have not attempted to use a datatable yet, so perhaps the performance hit is coming in the webservice or javascript.
CodeKiwi
+1  A: 

I read somewhere (do not remember where exactly, seems that my memory is not that good :)) that generally binding to DataTable is more resources/time consuming than binding to a collection of objects.

I used the Telerik grid some time ago and know that it supports binding to a collection of objects and even sub-objects. During the evaluation I found an example and a help topic that explain how to fine-tune the binding to collections and I am pasting them here:

Demo

Help topic

Hope you will find them useful.

Dick

Dick Lampard
So what were your results of the evaluation, did you end up going with telerik?
CodeKiwi