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

Crash - Week view to Day view

1 Answer 60 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Ashish
Top achievements
Rank 1
Ashish asked on 09 Feb 2011, 12:22 AM
I am getting following error with crash in loading the page when I switch from Week view to Day view in RadScheduler control. I would appreciate insight on the same please.
=========================

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.
=============================
I am doing this on click of custom links on my page. and event handler for the links as follows

==============================
CODE BEHIND ASPX.CS

 

protected

 

override void OnLoad(EventArgs e)
{
        
base.OnLoad(e);
        DayLink.ServerClick +=
new EventHandler(DayLink_ServerClick);
        WeekLink.ServerClick +=
new EventHandler(WeekLink_ServerClick);
        MonthLink.ServerClick +=
new EventHandler(MonthLink_ServerClick);
}

 

 

void MonthLink_ServerClick(object sender, EventArgs e)
{    
        SchedulerSelectedView =
SchedulerViewType.MonthView;
}

 

 

void WeekLink_ServerClick(object sender, EventArgs e)
{
        SchedulerSelectedView =
SchedulerViewType.WeekView;
}

 

 

void DayLink_ServerClick(object sender, EventArgs e)
{
        SchedulerSelectedView =
SchedulerViewType.DayView;
}

 

 

 

public SchedulerViewType SchedulerSelectedView
{
        
set { timeBlockRadSchedulerControl.SelectedView = value; }
        
get { return timeBlockRadSchedulerControl.SelectedView; }
}

 

 

==============================****************************************************************************
ASPX PAGE
==============================
<body style="background-color:Silver" >
    <
form runat="server">
        <
rad:RadScriptManager ID="scriptManager" runat="server" AsyncPostBackTimeout="5000">
            
<Scripts>
                
<asp:ScriptReference Path="../../../common/includes/JavaScript/AJAXClientEvents.js" />
            
</Scripts>
        
</rad:RadScriptManager>
        <div class="FloatRightDiv">
            
<a runat="server" href="#" id="DayLink">Day</a>
            
<a id="WeekLink" runat="server" >Week</a>
            
<a id="MonthLink" runat="server" >Month</a>
        
</div>
    
<rad:RadScheduler ID="timeBlockRadSchedulerControl" runat="server" Height="100" Width="100" SelectedView="MonthView" DataKeyField="PrimaryKey" DataSubjectField="DisplayName" DataStartField="StartDate" DataEndField="AppointmentEndDate" >
    <appointmenttemplate>
        
<div id="recurrenceDiv" runat="server">
            
<div class="rsAptTermsOfCourt">
                
<asp:Label ID="timeBlockNameLabel" runat="server" Text="TT"></asp:Label>
                
<asp:Label ID="appointmentTimeLabel" runat="server" Text="10:20 PM"></asp:Label>
                
<asp:Label ID="subjectapptLabel" runat="server" Text="Subject"></asp:Label>
            </div>
        </div>
    </appointmenttemplate>
</rad:RadScheduler>

</form>
</
body>
========================***************************************************************************************

 

1 Answer, 1 is accepted

Sort by
0
Ashish
Top achievements
Rank 1
answered on 09 Feb 2011, 03:50 PM
And this works perfectly fine when I click
On View      --> Clicked Link

Month View --> Day View
Day View -->    Month View
Day View --> Week View
Week View --> Month View
Month View --> Week View

It crashes when I click
On View      --> Clicked Link
Week View --> Day View
On Click of this, it throws following exception
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.
Tags
Scheduler
Asked by
Ashish
Top achievements
Rank 1
Answers by
Ashish
Top achievements
Rank 1
Share this question
or