Crash - Week view to Day view

2 posts, 0 answers
  1. Ashish
    Ashish avatar
    4 posts
    Member since:
    May 2009

    Posted 08 Feb 2011 Link to this post

    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>
    ========================***************************************************************************************

     

  2. Ashish
    Ashish avatar
    4 posts
    Member since:
    May 2009

    Posted 09 Feb 2011 Link to this post

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