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

Changing Selected view via event causing exception

1 Answer 35 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
EmpowerIT
Top achievements
Rank 2
EmpowerIT asked on 03 Feb 2010, 11:15 PM
Hi,

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




1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 04 Feb 2010, 09:35 AM
Hello,

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 />

Regards,
Peter
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.
Tags
Scheduler
Asked by
EmpowerIT
Top achievements
Rank 2
Answers by
Peter
Telerik team
Share this question
or