This is a migrated thread and some comments may be shown as answers.
radDropdownMenu
1 Answer 60 Views
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 30 Jul 2008, 09:44 AM

Hi Telerik,

I added RadDropDownMenu to every node in tree view.

Code:
dim MenuItem1 as new Telerik.Wincontrols.UI.RadMenuItem
dim MenuItem2 as new Telerik.Wincontrols.UI.RadMenuItem

MenuItem1.text="Test Drop Down Menu1"
dropdownmenu.items.add(MenuItem1)

MenuItem2.text="Test Drop Down Menu2"
dropdownmenu.items.add(MenuItem2)

My question is how to get the index of the MenuItem1 or MenuItem2 when you click the RadDropDownMenu?

Thanks

1 Answer, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 01 Aug 2008, 09:49 AM
Hi Erik,

If you look at the code of the RadTreeView context menu example in the Quick-Start application you will notice the following method:
private void radMenuItem_Click(object sender, EventArgs e) 
        {    
            RadMenuItem item = sender as RadMenuItem; 
 
            if (item != null
            { 
                label3.Text = this.clickedNode; 
                label4.Text = item.Text; 
            } 
        } 

Here, the important part is that the sender is actually the menu item, so you can use it to find its index in the Items collection of the menu (using the IndexOf method).

Hope that helps.

Regards,
Jordan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Erik
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Share this question
or