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

Failed to Load ViewState Crash

1 Answer 88 Views
Documentation and Tutorials
This is a migrated thread and some comments may be shown as answers.
Mark Galbreath
Top achievements
Rank 2
Mark Galbreath asked on 17 Aug 2009, 01:50 PM
I am really confused and aggravated by this error that apparently is a bug in the current release (Quarter 2, 2009), as evidenced on page 156 of the "RadControls for ASP.NET AJAX" developer's manual, "Handling ViewState Conflicts."  It states, in part, that "one last wrinkle that you may run into is that as your control tree becomes more complex...[you're screwed]."

I have 5 RadGrids on a webform and I simply want them to work.  However, after the page loads, the grids are filled with data, and when any row or menu item is selected, the application crashes because of this "little wrinkle."

So I copied your work-around code to kill viewstate on control first load, but (damnit!) you only give an example FOR ONE CONTROL!!!  What about the more likely event that there will be multiple controls on a page?  How is that addressed?

And then, at the bottom of page 157 in the work-around code, where the hell does IDynamicControl come from?  It's not in the APIs of System.Web.UI nor Telerik.Web.UI and fails to compile.

Finally, there is no mention of this "little wrinkle" in the RadGrid section of the manual - I stumbled upon the above entriely by chance.

Sheesh!!!

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 20 Aug 2009, 08:36 AM
Hello Mark,

On page 153, a little after we start talking about dynamic loading of user controls with AJAX, you can see that we define a custom interface IDynamicControl with a single method void FirstLoad(). We do this so that we define a way to have our custom loaded user controls to properly execute initialization logic on very first load.

The viewstate conflict exception is not additionally included in the RadGrid section, as, considering the topic, it would be best to discuss it in a section about dynamically loaded controls and AJAX. RadGrid  is not usually involved in a lot of conversations about dynamic creation and viewstate consistency.

The same ViewState disabling example applies both to a single as well as multiple user controls. You just have to have them all implement the IDynamicControl interface to define first-run logic. You can then load them all with the private Control LoadUserControl(Control parentControl,
string newControlPath, bool isFirstLoad)
method.

Regards,
Veli
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
Documentation and Tutorials
Asked by
Mark Galbreath
Top achievements
Rank 2
Answers by
Veli
Telerik team
Share this question
or