Home Unanswered Active Tags New Question

Deletion of events

I currently allow users to delete events using either a right click option or the delete option in the upper right corner.

I have a couple of issues/questions

1) How can I add a confirm prompt when the user clicks on the x in the upper right corner?

2) when using the context menu, all works fine with the exception that my page does not refresh, when using it to do an ajax call. I am using Atlas and when they click on the x in the upper right corner of the event the screen refreshes correctly, however when they use the context menu it doesn't. Both methods invoke the same logic.

Thanks

Asked by Anonymous 4 years ago.
Replies
Here are the results of our private discussion:

1) The confirmation dialog can be added by switching to JavaScript handling and calling the callback manually:
EventDeleteHandling="JavaScript"
EventDeleteJavaScript="if (confirm('Do you really want to delete ' + e.text() + ' ?')) dpc1.eventDeleteCallBack(e);"
If you are using DayPilot inside an UpdatePanel, you will need to call PostBack in order to execute partial update of the UpdatePanel:
EventDeleteHandling="JavaScript"
EventDeleteJavaScript="if (confirm('Do you really want to delete ' + e.text() + ' ?')) dpc1.eventDeletePostBack(e);"
2) This wasn't working because the menu item was executing a callback instead of postback (it was inside an UpdatePanel as well).

This definition
<daypilot:daypilotmenu id="DayPilotMenu1" runat="server" ClientObjectName="dpc1" 
ShowMenuTitle="False">
<DayPilot:MenuItem Text="Delete" Action="JavaScript" Command="Delete"
JavaScript="if (confirm('Do you really want to delete this event?'))
dpc1.eventMenuClickCallBack(e, command);"></DayPilot:MenuItem>
</daypilot:daypilotmenu>
has to be replaced with this definition:

<daypilot:daypilotmenu id="DayPilotMenu1" runat="server" ClientObjectName="dpc1" 
ShowMenuTitle="False">
<DayPilot:MenuItem Text="Delete" Action="JavaScript" Command="Delete"
JavaScript="if (confirm('Do you really want to delete this event?'))
dpc1.eventMenuClickPostBack(e, command);"></DayPilot:MenuItem>
</daypilot:daypilotmenu>

Note that internal callbacks are working inside UpdatePanel as well but the possibilities are limited: During the internal callback you can only update the DayPilot events - other controls on the page are not accessible. Partial PostBack (using UpdatePanel) allows you to access all DayPilot properties and other controls inside the UpdatePanel but it will be a bit slower (a bigger piece of HTML is being updated).
Answer posted by Dan Letecky 4 years ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java