Recurrence Exceptions Not Resetting in Code Behind

4 posts, 0 answers
  1. Dan Lehmann
    Dan Lehmann avatar
    103 posts
    Member since:
    May 2011

    Posted 06 Jun 2011 Link to this post

    Hello,
    I am doing all my data handling in the code behind. If I create a daily recurring appointment the parent RecurrenceRule gets updated correctly and I end up with, for example: DTSTART:20110606T073000Z\n\rDTEND:20110606T083000Z\n\rRRULE:FREQ=DAILY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR\n\rEXDATE:20110609T073000Z

    I can edit everything about the series except removing the the exceptions.

    I notice that in the examples resetting exceptions reflects immediately in the UI, before clicking save. For me, this does not happen. It says Working... Then it says Done.. But the deleted day does not return. And when I click Save, in the code behind, the AppointmentUpdate event, e.ModifiedAppointment.RecurrenceRule shows the exceptions I was trying to remove.

    Is there an event server or client side that I need to be handling?

    Here is my aspx and codebehind:
    <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="CRMScheduler.ascx.vb" Inherits="CRM_TestClient.CRMScheduler" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="rad" %>
     
    <rad:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <rad:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <rad:AjaxUpdatedControl ControlID="RadAjaxManager1" />
                </UpdatedControls>
            </rad:AjaxSetting>
            <rad:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <rad:AjaxUpdatedControl ControlID="Scheduler" />
                </UpdatedControls>
            </rad:AjaxSetting>
            <rad:AjaxSetting AjaxControlID="Scheduler">
                <UpdatedControls>
                    <rad:AjaxUpdatedControl ControlID="Scheduler" />
                </UpdatedControls>
            </rad:AjaxSetting>
        </AjaxSettings>
    </rad:RadAjaxManager>
     
    <rad:RadScheduler runat="server" ID="Scheduler" Width="753px" Height="600px" Skin="Vista"
      EnableExactTimeRendering="true" StartEditingInAdvancedForm="true" StartInsertingInAdvancedForm="true"
      DataKeyField="Schedule_id" DataStartField="Start" DataEndField="End" DataSubjectField="Subject" DataDescriptionField="Description" DataRecurrenceField="RecurrenceRule"
      DataReminderField="Reminder" DataRecurrenceParentKeyField="RecurrenceParentSchedule_id" AppointmentContextMenuSettings-EnableDefault="false" TimeSlotContextMenuSettings-EnableDefault="false" TimelineView-UserSelectable="false" >
        <AdvancedForm Modal="true"  />
     
    </rad:RadScheduler>


    Imports System
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports Telerik.Web.UI
     
    Public Class CRMScheduler
        Inherits System.Web.UI.UserControl
     
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                ' 2011-06-03 10:00:00
                Scheduler.SelectedDate = Now()
                Scheduler.SelectedView = SchedulerViewType.WeekView
                Scheduler.DayStartTime = New TimeSpan(7, 0, 0)
                Scheduler.DayEndTime = New TimeSpan(20, 0, 0)
                Scheduler.WorkDayStartTime = New TimeSpan(8, 0, 0)
                Scheduler.WorkDayEndTime = New TimeSpan(18, 0, 0)
                Scheduler.FirstDayOfWeek = DayOfWeek.Monday
                Scheduler.LastDayOfWeek = DayOfWeek.Saturday
                BindSchedule()
            End If
        End Sub
     
        Private Sub BindSchedule()
            Dim ds As List(Of objCRM.Schedule) = objCRM.Schedule.SelectScheduleByDealer(Session("Dealer_id"))
            For i As Int32 = 0 To ds.Count - 1
                If ds(i).RecurrenceRule = "" Then
                    ds(i).RecurrenceRule = Nothing
                End If
            Next
            Scheduler.DataSource = ds
            Scheduler.DataBind()
        End Sub
     
        Private Sub Scheduler_AppointmentDataBound(sender As Object, e As Telerik.Web.UI.SchedulerEventArgs) Handles Scheduler.AppointmentDataBound
            Dim RecurrenceRule As String = e.Appointment.RecurrenceRule
            If e.Appointment.RecurrenceParentID = -1 Then
                e.Appointment.RecurrenceParentID = Nothing
            End If
     
        End Sub
        Private Sub Scheduler_AppointmentDelete(sender As Object, e As Telerik.Web.UI.AppointmentDeleteEventArgs) Handles Scheduler.AppointmentDelete
            objCRM.Schedule.DeleteSchedule(e.Appointment.ID)
            BindSchedule()
        End Sub
        Private Sub Scheduler_AppointmentInsert(sender As Object, e As Telerik.Web.UI.AppointmentInsertEventArgs) Handles Scheduler.AppointmentInsert
            Dim User_id As Int32 = -1
            Dim Subject As String = e.Appointment.Subject
            Dim Description As String = e.Appointment.Description
            Dim Start As String = e.Appointment.Start.ToString
            Dim [End] As String = e.Appointment.End.ToString
            Dim RecurrenceRule As String = e.Appointment.RecurrenceRule.ToString
            Dim RecurrenceParentSchedule_id As String = IIf(e.Appointment.RecurrenceParentID Is Nothing, -1, CInt(e.Appointment.RecurrenceParentID))
            Dim Reminder As String = e.Appointment.Reminders.ToString
            Dim s As objCRM.Schedule = New objCRM.Schedule(Session("Dealer_id"), User_id, Subject, Description, Start, [End], RecurrenceRule, RecurrenceParentSchedule_id, Reminder)
            BindSchedule()
        End Sub
        Private Sub Scheduler_AppointmentUpdate(sender As Object, e As Telerik.Web.UI.AppointmentUpdateEventArgs) Handles Scheduler.AppointmentUpdate
     
            Dim s As objCRM.Schedule = New objCRM.Schedule(e.Appointment.ID)
     
            ' Dim User_id As Int32 = -1
            s.Subject = e.ModifiedAppointment.Subject
            s.Description = e.ModifiedAppointment.Description
            s.Start = e.ModifiedAppointment.Start.ToString
            s.[End] = e.ModifiedAppointment.End.ToString
            s.RecurrenceRule = e.ModifiedAppointment.RecurrenceRule.ToString
            s.RecurrenceParentSchedule_id = IIf(e.ModifiedAppointment.RecurrenceParentID Is Nothing, -1, CInt(e.ModifiedAppointment.RecurrenceParentID))
            s.Reminder = e.ModifiedAppointment.Reminders.ToString
     
            s.Update()
     
            BindSchedule()
        End Sub
        Private Sub Scheduler_NavigationCommand(sender As Object, e As Telerik.Web.UI.SchedulerNavigationCommandEventArgs) Handles Scheduler.NavigationCommand
            BindSchedule()
        End Sub
     
    End Class
  2. Dan Lehmann
    Dan Lehmann avatar
    103 posts
    Member since:
    May 2011

    Posted 08 Jun 2011 Link to this post

    Submitting a ticket...

    Thanks,
    Dan
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 09 Jun 2011 Link to this post

    Hello Dan Lehmann,

    We replied in the ticket  you sent, but for community reference, I will paste our answer here:

    "This functionality is handled automatically by RadScheduler and the advanced form. You don't need to implement it explicitly. When you click on 'reset exceptions' in the advanced form, AppointmentUpdate is fired to update the recurrence rule of the master appointment, but also AppointmentDelete for the exception is fired to remove this appointment. You can test the behavior in this online demo -
    http://demos.telerik.com/aspnet-ajax/scheduler/examples/bindtolist/defaultcs.aspx

    Only AppointmentInsert/Update/Delete are handled like this:
    protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e) 
           
               Appointments.Add(new AppointmentInfo(e.Appointment)); 
           
           protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) 
           
               AppointmentInfo ai = FindById(e.ModifiedAppointment.ID); 
               ai.CopyInfo(e.ModifiedAppointment); 
           
           protected void RadScheduler1_AppointmentDelete(object sender, SchedulerCancelEventArgs e) 
           
               Appointments.Remove(FindById(e.Appointment.ID)); 
           }


    Note that AppointmentDataBound is not handled. I am not sure why you handle this event in your code sample. Probably, that it is interfering with the default behavior of RadScheduler. "



    Greetings,
    Peter
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. Dan Lehmann
    Dan Lehmann avatar
    103 posts
    Member since:
    May 2011

    Posted 09 Jun 2011 Link to this post

    Here are some more details: Before I was storing RecurrenceParentID as an Int and was converting them to -1 then changing them back to Nothing in the AppointmentDataBound. I changed it to String and allowed nulls in the db, converting the DBNull.Value to Nothing in the datalayer.

    That allowed me to get rid of the AppointmentDataBound handler.

    Thank Again,
    Dan
Back to Top