Welcome Guest Search | Active Topics | Sign In | Register

Context Menu in TreeView Options
ron
Posted: Monday, January 4, 2010 12:50:43 PM
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>
...
eo_support
Posted: Monday, January 4, 2010 2:26:48 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You will need to use TreeView.ContextNode property.

Thanks!
Sam
Posted: Monday, January 4, 2010 2:30:47 PM
Rank: Newbie
Groups: Member

Joined: 1/4/2010
Posts: 5
Missed that - Thanks...

What is the purpose of the TreeNode in the event block?
eo_support
Posted: Monday, January 4, 2010 2:35:57 PM
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!
Sam
Posted: Monday, January 4, 2010 2:38:11 PM
Rank: Newbie
Groups: Member

Joined: 1/4/2010
Posts: 5
Thanks for the explanation...


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.