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

3 posts, 0 answers
  1. Khurram
    Khurram avatar
    3 posts
    Member since:
    May 2014

    Posted 03 May 2014 Link to this post

    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. Khurram
    Khurram avatar
    3 posts
    Member since:
    May 2014

    Posted 05 May 2014 Link to this post

    Please anyone. Can you people help me???
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 07 May 2014 Link to this post

    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.

     
Back to Top