This is a migrated thread and some comments may be shown as answers.

Client-side menu item click: get value of menu item

2 Answers 189 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 1
JP asked on 28 Sep 2011, 01:18 PM
Hi,

I create (server-side) a context menu for a RadTree and set the menu item clicked event:
radTreeView.OnClientContextMenuItemClicked = "OnCatalogTreeItemClicked";

This is the menu item I add:
RadTreeViewContextMenu contextMenu = new RadTreeViewContextMenu();
contextMenu.ClickToOpen = true;
 
RadMenuItem item = new RadMenuItem("Delete this node");
item.Value = "delete";
contextMenu.Items.Add(item);
radTreeView.ContextMenus.Add(contextMenu);

How can I access the item's value (="delete") in the client-side javascript event?
It's quite easy to get the menu item from the event args and also the caption, but how do I get the value?
Or is the value only supposed for server-side usage and I have to add the value as an attribute to the menu item?

Thanks for your help!

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 28 Sep 2011, 02:33 PM
Hello JP,

You can get the valye by using the get_value() method as shown below.
javascript:
function OnClientContextMenuItemClicked(sender,args)
{
       alert(args.get_menuItem().get_value(););
 }

Thanks,
Princy.
0
JP
Top achievements
Rank 1
answered on 28 Sep 2011, 02:55 PM
It's so simple that I'm wondering why I haven't found that myself...

Thanks for your quick reply!
Tags
TreeView
Asked by
JP
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
JP
Top achievements
Rank 1
Share this question
or