Version

SelectionChanging Property (DropDownClientEvents)

Syntax
'Declaration
 
Public Property SelectionChanging As String
public string SelectionChanging {get; set;}
Example
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);       
      
}
Requirements

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

See Also