Failed to load viewstate

3 posts, 1 answers
  1. Corey Alguire
    Corey Alguire avatar
    43 posts
    Member since:
    Sep 2004

    Posted 25 Jun 2008 Link to this post

    Ok, another problem I uncovered and could use some help with. I am using RadScheduler 2008.1.619.20 along with RadAjaxManager, RadTooltipManager a RadCalendar control and RadContextMenus (what can I say, you have great controls ;)

    On the page, I have implemented a search feature that binds a list of dates from an SQL database to a GridView (sorry- just the standard Microsoft .Net control here). When a user clicks a row in the Gridview, it calls some client-side javascript that performs an AjaxRequest using the RadAjaxManager. During the request, the SelectedDate is changed for both the Calendar and Scheduler controls, and the Scheduler is re-set to Day view.

    This all worked fine with the previous version of the Q1 2008 controls. However, I now get the following error at the end of the callback: 

    Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

    Any insight into possible solutions here would be greatly appreciated.
  2. Answer
    T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 27 Jun 2008 Link to this post

    Hello Corey,

    (same reply as in the ticket)

    I cannot be sure what is happening without looking at the code, but I can give you some suggestions based on your description. ViewState problems are especially tricky to track down, so it would be best if you can send us a sample page.

    You should check if RadAjaxManager is set up to update all of the controls that are affected in the AjaxRequest method, for example:

    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
        <UpdatedControls> 
            <telerik:AjaxUpdatedControl ControlID="RadScheduler1" /> 
            <telerik:AjaxUpdatedControl ControlID="Calendar1" /> 
        </UpdatedControls> 
    </telerik:AjaxSetting> 

    The AjaxUpdate method is called late in the page life-cycle, so RadScheduler might need a call to Rebind() to clear it's internal state after you set its properties to their new values.

    Turning off the ViewState of the controls, one by one, might also help you track down the problem to a particular control.

    All the best,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Corey Alguire
    Corey Alguire avatar
    43 posts
    Member since:
    Sep 2004

    Posted 27 Jun 2008 Link to this post

    Thanks, Tsvetomir!
    As I answered when closing the Support Ticket, I had already made sure the AjaxManager was updating the participating controls, and I had already tried rebinding the Scheduler. I hadn't thought to try shutting off viewstate one control at a time. Shutting it off for the gridview solved the problem completely.

    I appreciate the help. Best regards,
    Corey.
Back to Top