Update of WebDatePicker from selected date in calendar can be canceled and value can be modified.
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.
WebDatePicker1.ClientSideEvents.CalendarClosed = "WebDatePicker_CalendarClosed"
WebDatePicker1.ClientSideEvents.CalendarClosed = "WebDatePicker_CalendarClosed";
// The client event 'CalendarClosed' takes two parameters sender and e // sender is the object which is raising the event // e is the TextEditorValueChangingEventArgs function WebDatePicker_CalendarClosed(sender, e) { //Gets the new date selected in the drop-down calendar var newValue = e.get_value(); if(!confirm("Are you sure you want to select the date '" + newValue + "'?")) //Cancels the selected date in the drop-down calendar from updating as the value of the editor 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