Update action from list-selection can be canceled.
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.ListClosed = "WebMonthCalendar1_ListClosed"
WebMonthCalendar1.ClientEvents.ListClosed = "WebMonthCalendar1_ListClosed";
// The client event 'ListClosed' takes two parameters sender and e // sender is the object which is raising the event // e is the CalendarListCloseEventArgs function WebMonthCalendar1_ListClosed(sender, e) { //Gets the selected value from the list var selectedValue = e.get_selectedValue(); //Gets the id of the list; 1 – list of Months , 2 – list of Years, 3 – list of Decades. var id = e.get_id(); switch (id) { case 1: if (selectedValue != -1) { if (!confirm("Are you sure you want to select the month as '" + selectedValue + "'?")) //Cancels the event and unselects any value if selected. e.set_cancel(true); break; } case 2: if (selectedValue != -1) { if (!confirm("Are you sure you want to select the Year as '" + selectedValue + "'?")) //Cancels the event and unselects any value if selected. e.set_cancel(true); break; } case 3: if (selectedValue != -1) { if (!confirm("Are you sure you want to select the Decade as '" + selectedValue + "'?")) //Cancels the event and unselects any value if selected. 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