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

Having issues in Telerik's RadScheduler when using recurrence fields and events

2 Answers 130 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Khurram
Top achievements
Rank 1
Khurram asked on 03 May 2014, 11:41 AM
I am using RadScheduler for showing/creating the Appointments in my Database.
My code is working fine (Create, Retrieve, Update, Delete) as long as I have non-recurring Appointments. But, as soon as a recurring type Appointment comes in account, everything stops working and I get following error on postback:
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.

What am I doing wrong here? 
Following is my code, On .ASPX page:
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadScheduler ID="RadScheduler1" runat="server" TimeZoneOffset="00:00:00" AdvancedForm-EnableCustomAttributeEditing="true"
        SelectedView="MonthView" OverflowBehavior="Expand" StartInsertingInAdvancedForm="true" EnableViewState="true"
        DataKeyField="AppointmentID" DataStartField="CalendarStartDateTime" DataEndField="CalendarEndDateTime"
        DataSubjectField="AppointmentBody" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="ParentAppointmentID"
        DataReminderField="Reminder" OnAppointmentCreated="RadScheduler1_AppointmentCreated" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
        OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnAppointmentDelete="RadScheduler1_AppointmentDelete"
        OnRecurrenceExceptionCreated="RadScheduler1_RecurrenceExceptionCreated" OnReminderDismiss="RadScheduler1_ReminderDismiss"
        OnReminderSnooze="RadScheduler1_ReminderSnooze">
        <AdvancedForm Modal="true"></AdvancedForm>
        <Reminders Enabled="true" MaxAge="5"></Reminders>
        <TimeSlotContextMenuSettings EnableDefault="true"></TimeSlotContextMenuSettings>
        <AppointmentContextMenuSettings EnableDefault="true"></AppointmentContextMenuSettings>
    </telerik:RadScheduler>
</asp:Content>


And Code on .CS page:
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        BindAppointments();
    }
}
 
private void BindAppointments()
{
    try
    {
        List<AppointmentEN> lstAppointment = AppointmentProvider.GetAppointments();
 
        foreach (var item in lstAppointment)
        {
            item.RecurrenceRule = string.IsNullOrWhiteSpace(item.RecurrenceRule) ? null : item.RecurrenceRule;
            item.ParentAppointmentID = item.ParentAppointmentID == 0 ? null : item.ParentAppointmentID;
        }
        RadScheduler1.DataSource = lstAppointment;
        RadScheduler1.DataBind();
 
        RadScheduler1.SelectedView = SchedulerViewType.MonthView;
        RadScheduler1.SelectedDate = DateTime.Now;
        //RadScheduler1.Visible = true;
    }
    catch (Exception ex)
    {
    }
}


I have found that doing EnableViewState="false" does the job, but I don't want to do that because then other functionalities like Rescource editing stops working correctly.

2 Answers, 1 is accepted

Sort by
0
Khurram
Top achievements
Rank 1
answered on 05 May 2014, 10:44 AM
Please anyone. Can you people help me???
0
Plamen
Telerik team
answered on 07 May 2014, 08:21 AM
Hello,

You can refer to this on-line demo where similar behavior have been implemented and the recurrence appointments are working correctly.

Hope this will be helpful.

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Scheduler
Asked by
Khurram
Top achievements
Rank 1
Answers by
Khurram
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or