// 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");
}