This is a migrated thread and some comments may be shown as answers.
NeedDataSource and ViewState from a base page
3 Answers 46 Views
This is a migrated thread and some comments may be shown as answers.
Oded
Top achievements
Rank 1
Oded asked on 03 Jun 2009, 02:06 PM
Hello,

I have a page that has a RadGrid in it. The grid uses the NeedDataSource to load the data.
The NeedDataSource calls a method on the page that returns a DataTable. This method is using a parameter that is retrieved from a property in a base page. Lets say that the property name is ParameterName. The value of this property is saved in the ViewState.

Most of the time everything is working fine; but sometimes the The ParameterName property is null. I have checked and saw that the NeedDataSource is called before the Page LoadViewState method. Is this normal?

How can I obtain the ViewState data before the NeedDataSource is called?

Thanks,

Oded

3 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 05 Jun 2009, 12:52 PM
Hi Oded,

Please, note that the NeedDataSource event of the grid is triggered later in the page life cycle than the loading of the ViewState. More information you can find in the following help topic (here).

The problem should be caused by something else in your implementation - e.g. if you are explicitly calling RadGrid's Rebind or Databind method in the Page_Init event for example.

I hope this helps.

Best Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Oded
Top achievements
Rank 1
answered on 07 Jun 2009, 05:12 AM
Tsvetoslav,

I think I have found the problem, I have in the grid with a custom editor that loads a RadComboBox into it. The combobox loads on demand from a wcf service. After I call the service and populate the combobox I press esc twice. Then when I try to page through the grid and now there is a problem with the viewstate.

I have canceled the reset event on the form and the problem was solved.

Any ideas on another solution for this problem?

Thanks,
Oded
0
Tsvetoslav
Telerik team
answered on 11 Jun 2009, 06:24 AM
Hello Oded,

I am not sure what exactly you meant by canceling "the reset event on the form", however, do note that by pressing ESC it might happen that the key press event bubbles up to cancel the request itself which may lead to unexpected behavior of the controls.

All the best,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Oded
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Oded
Top achievements
Rank 1
Share this question
or