Version

ItemSelected Property (DataMenuClientEvents)

Gets or Sets JavaScript function name that will handle ItemSelected client event.
Syntax
'Declaration
 
Public Property ItemSelected As String
public string ItemSelected {get; set;}

Property Value

The Javascript function name.
Example
WebDataMenu1.ClientEvents.ItemSelected = "WebDataMenu1_ItemSelected"
WebDataMenu1.ClientEvents.ItemSelected = "WebDataMenu1_ItemSelected";
// The client event 'ItemSelected' takes two parameters sender and e
// sender  is the object which is raising the event
// e is the DataMenuItemCancelEventArgs

function WebDataMenu1_ItemSelected(sender, e) {


    //Gets the DataMenuItem object that is selected
    var Item = e.getItem();

    //Gets the text of the selected item
    var ItemText = Item.get_text();

    //Returns true if the selected item has children else false
    var hasChildren = Item.hasChildren();

    if (hasChildren == false) {
        alert("Item '" + ItemText + "' has no children");
    } else
        alert("Item '" + ItemText + "' has children");


}
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