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

Failed to load viewstate

2 Answers 203 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Corey Alguire
Top achievements
Rank 1
Corey Alguire asked on 25 Jun 2008, 10:00 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 27 Jun 2008, 12:26 PM
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
0
Corey Alguire
Top achievements
Rank 1
answered on 27 Jun 2008, 01:12 PM
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.
Tags
Scheduler
Asked by
Corey Alguire
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Corey Alguire
Top achievements
Rank 1
Share this question
or