DayPilot Knowledge Base

AJAX Calendar/Scheduling Controls
DayPilot Pro (AJAX Calendar Control)
» DayPilot AJAX Calendar
DayPilot Pro (AJAX Monthly Calendar Control)
» DayPilot AJAX Monthly Calendar
DayPilot Pro (AJAX Scheduler Control)
» DayPilot AJAX Scheduler
DayPilot » Knowledge Base » How to show a confirmation dialog before deleting an event (Calendar)

How to show a confirmation dialog before deleting an event (Calendar)

Last revision: May 28, 2012

calendar-delete-event-confirmation.png

In order to show a confirmation dialog box before deleting an Calendar event using the delete [x] icon (the upper-right event corner) you need to switch to JavaScript EventDelete handling:

<daypilot:daypilotcalendar id="DayPilotCalendar1" runat="server" 
  OnEventDelete="DayPilotCalendar1_EventDelete" 
  EventDeleteHandling="JavaScript" 
  EventDeleteJavaScript="if (confirm('Do you really want to delete ' + e.text() + ' ?')) dpc1.eventDeleteCallBack(e);" 
  ...
</daypilot:daypilotcalendar>

The JavaScript handler (EventDeleteJavaScript) will show a default browser confirmation dialog box. If the user confirms the action by clicking "OK" it will fire EventDelete event on the server side (using CallBack).

Related

How to show event-specific context menu
Event Calendar for jQuery (ASP.NET MVC)
How to show event details in a modal dialog (modal.js)
How to open a new event dialog using TimeRangeSelected event (modal.js)