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

NeedDataSource when grid is created on page init

3 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Manuel Ortiz
Top achievements
Rank 1
Manuel Ortiz asked on 29 Jul 2010, 06:51 PM
Hi, is it correct to use the NeedDataSource event handler when the grid is created entirely on code behind (including the datasource) on page init?  Is there any recommendation on how to bind a grid created on page init to an SQLDataSource control created on code behind or initialized in client code but manipulated server side (the datasource)?  Is there any way in which I can prevent the grid from databinding every time page init is invoked (eg: initializing the datasource on Not Page.IsPostBack)?

Thank you,
Manuel

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Jul 2010, 06:54 AM
Hi Manuel,

Here in the help documentation, it is described how to create grid dynamically. Please refer it to get an idea.

Programmatic creation
I hope this would help you to create grid programmatically.


-Shinu.
0
Manuel Ortiz
Top achievements
Rank 1
answered on 30 Jul 2010, 07:05 AM
Hey Shinu,

I already have my grid created dynamically and I have read the documentation you just sent me, however, I am trying to optimize grid and page performance.  That's why I ask if I am able to use the NeedDataSource event in a grid such as this one, so I don't have to create and bind to the datasource everytime page Init is fired.  Is there any other optimization you would recommend me?

Thanks,
Manuel
0
Pavlina
Telerik team
answered on 02 Aug 2010, 02:37 PM
Hello Manuel,

In order to improve the performance you could save the data in session, ViewState or Cache(depending on the scope of the data).

For more information you can refer to this help article:
Saving the grid ViewState in Session

Best wishes,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Manuel Ortiz
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Manuel Ortiz
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or