WebDropDown1.ClientEvents.SelectionChanging = "WebDropDown_SelectionChanging"
WebDropDown1.ClientEvents.SelectionChanging = "WebDropDown_SelectionChanging";
// The client event 'SelectionChanging' takes two parameters sender and e // sender is the object which is raising the event // e is the DropDownSelectionEventArgs function WebDropDown_SelectionChanging(sender, e) { //Gets the new collection of selected drop-down items //Only one item will be in the collection when single selection is enabled var newSelection = e.getNewSelection(); //Gets the text of the first drop-down item in the collection var text = newSelection[0].get_text(); //Gets the index of the first drop-down item in the collection var index = newSelection[0].get_index(); if (!confirm("Are you sure you want to select the item '" + text + "' at index " + index + "?")) //Cancels the SelectionChanging client event e.set_cancel(true); }