Failed to Load ViewState Crash

2 posts, 0 answers
  1. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 17 Aug 2009 Link to this post

    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.

  2. Veli
    Veli avatar
    2002 posts

    Posted 20 Aug 2009 Link to this post

    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)

    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.
Back to Top