Home Unanswered Active Tags New Question

"CommandHandler is not a function" JavaScript error

This JavaScript error can appear when you upgrade DayPilot Pro 3.5 to DayPilot Pro 3.6. It is caused by a changed JavaScript API for calling server-side EventMenuClick event from JavaScript (using AJAX callback or PostBack).

This example asks the user for confirmation before the menu action is executed.

Old syntax:
<DayPilot:MenuItem Action="JavaScript" Command='Delete' 
JavaScript="if (confirm('Do you really want to delete this event?'))
ctl00_ContentPlaceHolder1_DayPilotCalendar1.CommandHandler('Delete', '{0}', '{1}');"
Text="Delete" />
New syntax:
<DayPilot:MenuItem Action="JavaScript" Command='Delete' 
JavaScript="if (confirm('Do you really want to delete this event?'))
ctl00_ContentPlaceHolder1_DayPilotCalendar1.eventMenuClickCallBack(e, command);"
Text="Delete" />

See also the documentation for context menu.
Asked by Dan Letecky 5 years ago.
Replies
No reply yet.
New Reply
This reply is
Your name (optional):

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