|
Rank: Member Groups: Member
Joined: 12/2/2009 Posts: 23
|
Hi,
I am trying to add a Context Menu in TreeView.
Although the doc file does not contain any easlily locatable information on how to do this, I used the demo code to make some progress. Unfortunately, the demo does not contain code to handle the right click, only to display it.
I set RaiseServerEvent to true and added a click handler to the menu.
This allows me to get control back to my code and see which menu item was clicked on in e.MenuItem.
So far so good.
Where I am stuck is in determining the TreeNode that the menu was on.
I found a TreeNode property in the NavigationItemEventArgs that appears to be what I want. The only problem is that it is always null. I updated the demo with my changes and confirmed that this also returns null. (see code changes below)
What am I missing?
Expanding the demos to be functional from a coding perspective would help cut down on the number of posts you receive. This demo is visually functional, but does not contain the code needed to handle a selection.
protected void Menu1_ItemClick(object sender, NavigationItemEventArgs e) { EO.Web.MenuItem mi = e.MenuItem; EO.Web.TreeNode tn = e.TreeNode; int i = 0; }
<eo:ContextMenu id="Menu1" Width="144px" runat="server" ControlSkinID="None" onitemclick="Menu1_ItemClick" RaisesServerEvent="True"> <TopGroup Style-CssText="cursor:hand;font-family:Verdana;font-size:11px;"> <Items> ...
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You will need to use TreeView.ContextNode property.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 1/4/2010 Posts: 5
|
Missed that - Thanks...
What is the purpose of the TreeNode in the event block?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
That property is used when you handle click event of a TreeView control. In your case you are handling the click event of a Menu control. However the Menu is displayed is irrelevant.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 1/4/2010 Posts: 5
|
Thanks for the explanation...
|
|