Event for saving an EXISTING appointment

2 posts, 0 answers
  1. Vijay
    Vijay avatar
    4 posts
    Member since:
    Sep 2013

    Posted 30 Oct 2013 Link to this post

    On the save of the appointment I need to differentiate between the save of new appointment vs. an existing appointment.

    I am aware that the save of a new appointment triggers the following event:

    this.radSchedulerControl.AppointmentAdded += new EventHandler<AppointmentAddedEventArgs>(radSchedulerControl_AppointmentAdded);


    And the save of the existing event triggers the following event with the action of the event = "ItemChanged"

    this.radSchedulerControl.Appointments.CollectionChanged += new Telerik.WinControls.Data.NotifyCollectionChangedEventHandler(Appointments_CollectionChanged);
    ....however the problem with this event is that it get triggered multiple times based on what was changed for on the existing appointment.

    A different thread suggested using the ApplySettingsToEvent function in the CustomAppointmentEditDialog class when saving an appointment to add my custom logic. However, in ApplySettingsToEvent I could not determine how to differentiate when a new Appointment is created vs an existing one is saved since this function gets executed on both the creation of a new appointment and the save of an existing.

    Your help in determining how to execute custom logic only on the save of an existing appointment and have it triggered only once would be appreciated.



  2. Dess
    Dess avatar
    1562 posts

    Posted 04 Nov 2013 Link to this post

    Hello Vijay,

    Thank you for contacting Telerik Support.

    You can distinguish whether you have updated an existing appointment or created a new one using the following code snippet:
    public Form1()
        for (int i = 0; i < 10; i++)
            Appointment appointment = new Appointment(DateTime.Now.AddDays(i), TimeSpan.FromMinutes(30), "Summary", "Description");
            appointment.StatusId = 2;
            appointment.BackgroundId = 6;
        this.radScheduler1.AppointmentEditDialogShowing += radScheduler1_AppointmentEditDialogShowing;
    private void radScheduler1_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
        e.AppointmentEditDialog = new CustomEditAppointmentDialog();
    public class CustomEditAppointmentDialog : EditAppointmentDialog
        protected override void ApplySettingsToEvent(IEvent targetEvent)
            RadScheduler scheduler = this.SchedulerData as RadScheduler;
            if (scheduler != null)
                bool isEditedEvent = false; //true->edited an existing appointment; false->created a new appoitment
                if (targetEvent.MasterEvent == null)
                    isEditedEvent = scheduler.Appointments.Contains(targetEvent);
                    isEditedEvent = scheduler.Appointments.Contains(targetEvent.MasterEvent);

    I hope this information helps. Should you have further questions, I would be glad to help.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft R3 2016 release webinar banner
Back to Top