search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

"CommandHandler is not a function" JavaScript error

Asked by Dan Letecky
13 years ago.
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.
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.