This is a migrated thread and some comments may be shown as answers.

RadGrid viewstate

3 Answers 343 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Satya
Top achievements
Rank 1
Satya asked on 14 Oct 2011, 04:33 PM
Hi,

I am using RadGrid and doing a simple data binding to bind to a list. The enableviewstate is set to true. But the grid does not populate data after a postback. Am I doing any thing wrong.

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 17 Oct 2011, 09:59 AM
Hello Satya,

Can you please verify that you are using advanced data-binding with NeedDataSource event handling when passing the list as a grid source? This should ensure that the grid data will be visualized as expected on subsequent requests to the server.

Best regards,
Sebastian
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Satya
Top achievements
Rank 1
answered on 17 Oct 2011, 04:42 PM
Hi Sebastian,
thanks for your reply. The only problem I had with needadatasource is that with that event I am always hitting the database. My idea is just load the data once in the PageLoad and i wish the radgrid uses viewstate and populates on the postbacks like simple dropdown control. Is there a way to acheive that.

Thanks
Satya
0
Sebastian
Telerik team
answered on 18 Oct 2011, 02:00 PM
Hi Satya,

As you can see from the description of the demo which I referenced, the NeedDataSource event is raised when the control has to be bound to data, for instance when paging or sorting operation are triggered, and this is done automatically for you. If you do not want to hit the database when this happens, consider caching the grid data source and retrieve the data from the cache at a later stage.

The other solution would be to use simple binding with DataBind() calls in the same manner as you will do with a standard MS GridView control. In this situation you will have to bind the grid manually when certain operations like sorting, paging, etc. are processed. Bear in mind that in this case advanced operations like grouping, custom edit forms, etc. are not supported by our AJAX web grid.

Regards,
Sebastian
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Satya
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Satya
Top achievements
Rank 1
Share this question
or