Changing Selected view via event causing exception

2 posts, 0 answers
  1. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 03 Feb 2010 Link to this post


    I am trying to change the selected view on my scheduler via a SelectedIndexChanged event from a combo box. I do not want to give the user the ability to select all the views, so i have created a combo that only gives the options of timeline & month.

    When the user selects the option that it is not the default, I get the 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.

    If I use the combobox to change other properties, such as the selected date etc, it works fine. It only throws the exception when I am trying to change the selected view.

    Could you please tell me how I can get that working?

    void SchedulerView_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
            if (SchedulerView.SelectedValue == "Timeline"
                SiteSchedule.SelectedView = SchedulerViewType.TimelineView; 
            else if (SchedulerView.SelectedValue == "Month"
                SiteSchedule.SelectedView = SchedulerViewType.MonthView; 
    The controls are ajaxified using a rad ajax manager

  2. Peter
    Peter avatar
    6637 posts

    Posted 04 Feb 2010 Link to this post


    I did a simle web site following your description to test the case, but there was not problem at my end. Please, see the attached demo.

    If you just need to prevent users from going to other views, you can simply set the UserSelectable property:

    <DayView UserSelectable="false" />
    <WeekView UserSelectable=false />

    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top