Close-list action can be canceled only if item was selected in list of months or years.
Note: that event should not be interrupted by alert, confirm or similar action, which may break default order or timing of focus and other events of browser.
WebMonthCalendar1.ClientEvents.ListClosing = "WebMonthCalendar1_ListClosing"
WebMonthCalendar1.ClientEvents.ListClosing = "WebMonthCalendar1_ListClosing";
// The client event 'ListClosing' takes two parameters sender and e // sender is the object which is raising the event // e is the CalendarListCloseEventArgs function WebMonthCalendar1_ListClosing(sender, e) { //Gets the id of the list; 1 – list of Months , 2 – list of Years, 3 – list of Decades. var listId = e.get_id(); if (!confirm("Are you sure you want to close the list?")) //Cancels the 'ListClosing' event. e.set_cancel(true); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2