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

Delete button on Advanced Edit Form

1 Answer 158 Views
This is a migrated thread and some comments may be shown as answers.
Linda Soukup
Top achievements
Rank 1
Linda Soukup asked on 30 Mar 2010, 02:33 PM
Good Morning,

I have disabled the default delete appointment buttons in favor of a delete button on my advanced edit form in RadScheduler. This delete button works great except in one scenario. If I click on one occurrence of a recurring appointment and edit only that occurrence and then click the Delete button, it fails. I understand that when the occurrence that is to be deleted does not already exist as an exception then the only task is to update the recurrence string in the parent record, but I'm unsure as to accomplish this. The javascript behind my delete button is as follows:


function DeleteAppointment() {



    var scheduler = $find("<%= Scheduler1.ClientID %>");



    var app = scheduler.get_currentAppointment();



    var deleteSeries = (app.get_recurrenceState() == 1);


    scheduler.deleteAppointment(app, deleteSeries);



When this fails, the server-side DeleteAppointment event is not generated; thinking that this instance might use a different event, I also checked for OccurrenceDelete and RecurrenceExceptionCreated, but neither of those is occurring either. In addition, the advanced form is not hidden, which would seem to indicate that there is a problem in this situation.

Can you tell me how I can successfully delete an appointment recurrence?

Thanks for your help,

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 01 Apr 2010, 04:45 PM
Hello Linda,

We replied to the support ticket about this issue, but I will paste the answer for community reference here

"...You approach and logic are correct, however, we have not foreseen such a scenario for RadScheduler. It turned out that the appointment which you get with scheduler.get_currentAppointment(); after choosing the 'edit this occurrence option' is the exception which would eventually be created and not the occurrence itself. Therefore the exception does not have an id and it cannot be passed to the deleteAppointment() method.

The good news is that we can provide you with a workaround for now and we will probably improve RadScheduler to handle such cases correctly in the future. Here is what you can try:
<telerik:RadScheduler ID="RadScheduler1" runat="server" OnFormCreating="RadScheduler1_FormCreating"
           <asp:Button ID="Button2" runat="server" Text="Button" CommandName="Delete" /> 

protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e) 
       if (e.CommandName == "Delete"
           object editedAppointmentId = ViewState["editedAppointmentId"]; 
           if (editedAppointmentId != null
               Appointment apt = RadScheduler1.Appointments.FindByID(editedAppointmentId); 
               RadScheduler1.DeleteAppointment(apt, RadScheduler1.EditingRecurringSeries); 
   protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e) 
       if (e.Mode == SchedulerFormMode.AdvancedEdit || e.Mode == SchedulerFormMode.Edit) 
           ViewState["editedAppointmentId"] = e.Appointment.ID; 

the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Asked by
Linda Soukup
Top achievements
Rank 1
Answers by
Telerik team
Share this question