Hello,
Currently we are using the Scheduler in a Compostie Control. The scheduler is being built dynamically in the CreateChildControls method as such:
This routine gets called everytime (initial load and postbacks).
This works prefectly fine, data loads properly, so far so good. The problem occurs when we try to navigate to a different SchedulerViewType
In the NavigationComplete method we have the following code:
When the NavigationComplete method is hit, the following error occurs:
Unable to cast object of type 'Telerik.Web.UI.Scheduler.Rendering.DayView' to type 'Telerik.Web.UI.Scheduler.Rendering.MonthView'.
What I am looking for is a best practices for using Scheduler.Rebind(), specifically where and when it should be used in this instance.
Any insight would be greatly appreciated.
Thank you
Currently we are using the Scheduler in a Compostie Control. The scheduler is being built dynamically in the CreateChildControls method as such:
Controls.Clear(); |
Panel pnl = new Panel(); |
_scheduler = new Telerik.Web.UI.RadScheduler(); |
_scheduler.ID = "scheduler1"; |
//add server events |
_scheduler.NavigationCommand += new SchedulerNavigationCommandEventHandler(Scheduler_NavigationCommand); |
_scheduler.AppointmentDataBound += new AppointmentDataBoundEventHandler(Scheduler_AppointmentDataBound); |
_scheduler.AppointmentCommand += new AppointmentCommandEventHandler(Scheduler_AppointmentCommand); |
_scheduler.NavigationComplete += new SchedulerNavigationCompleteEventHandler(Scheduler_NavigationComplete); |
_scheduler.AppointmentUpdate += new AppointmentUpdateEventHandler(Scheduler_AppointmentUpdate); |
_scheduler.AppointmentCreated += new AppointmentCreatedEventHandler(Scheduler_AppointmentCreated); |
//add client events |
_scheduler.OnClientAppointmentClick = "AppointmentEditing"; |
_scheduler.OnClientRecurrenceActionDialogShowing = "RecurrenceActionDialogShowingHandler"; |
_scheduler.OnClientTimeSlotClick = "AppoinmentAdding"; |
_scheduler.MonthVisibleAppointmentsPerDay = 5; |
//SetViewType(_scheduler); |
SetSkin(_scheduler, CalendarSkin); |
_scheduler.ShowFullTime = true; |
_scheduler.StartEditingInAdvancedForm = false; |
_scheduler.StartInsertingInAdvancedForm = false; |
//_scheduler.WeekHeaderDateFormat = WeekHeaderFormat; |
//_scheduler.MonthHeaderDateFormat = MonthHeaderFormat; |
_scheduler.OverflowBehavior = OverflowBehavior.Expand; |
_scheduler.DataSource = this.EventData; |
_scheduler.DataKeyField = EventCalendar.ID; |
_scheduler.DataSubjectField = EventCalendar.Title; |
_scheduler.DataStartField = EventCalendar.StartDTm; |
_scheduler.DataEndField = EventCalendar.EndDTm; |
_scheduler.DataRecurrenceField = EventCalendar.RecurrencePattern; |
_scheduler.DataRecurrenceParentKeyField = EventCalendar.RecurringParentID; |
_scheduler.DataBind(); |
pnl.Controls.Add(_scheduler); |
Controls.Add(pnl); |
This routine gets called everytime (initial load and postbacks).
This works prefectly fine, data loads properly, so far so good. The problem occurs when we try to navigate to a different SchedulerViewType
In the NavigationComplete method we have the following code:
protected void Scheduler_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e) |
{ |
_scheduler.Rebind(); |
} |
When the NavigationComplete method is hit, the following error occurs:
Unable to cast object of type 'Telerik.Web.UI.Scheduler.Rendering.DayView' to type 'Telerik.Web.UI.Scheduler.Rendering.MonthView'.
What I am looking for is a best practices for using Scheduler.Rebind(), specifically where and when it should be used in this instance.
Any insight would be greatly appreciated.
Thank you