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

TreeNode context menu item click event

1 Answer 281 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Nisi
Top achievements
Rank 1
Nisi asked on 18 Mar 2008, 05:44 PM
Hello,

i have a RadTreeView with several nodes being added dynamically. on each node i am assigning the same context menu. in the click event for the items on the menu i need to know which node was right-clicked. how can i determine this?

1 Answer, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 19 Mar 2008, 08:42 AM
Hi Mac & Cheese,

The most secure way to get the node for which the context menu is shown is to use the ContextMenuShowing event.

Refer to the code below:

public Form1() 
    InitializeComponent(); 
 
    this.radTreeView1.ContextMenuShowing += new CancelEventHandler(radTreeView1_ContextMenuShowing); 
 
private RadTreeNode contextNode = null
 
void radTreeView1_ContextMenuShowing(object sender, CancelEventArgs e) 
    this.contextNode = sender as RadTreeNode; 

If you have any other questions or suggestions about RadTreeView do not hesitate to write me.

Regards,
Jordan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Treeview
Asked by
Nisi
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Share this question
or