Welcome Guest Search | Active Topics | Sign In | Register

Right click on tree node Options
tresa
Posted: Wednesday, October 17, 2007 9:22:51 AM
Rank: Newbie
Groups: Member

Joined: 10/12/2007
Posts: 8
Hi

I am trying to collect the node value on the right click of a tree node using the following subroutine, but this doesn't get executed. The node value will then in passed in the url on the context menu generated on the right click event.


Protected Sub Tree1_ItemClick(ByVal sender As Object, ByVal e AsEO.Web.NavigationItemEventArgs)
value_of_the_node=e.NavigationItem.Value
End Sub

I have set the raises event to true for the tree.
eo_support
Posted: Wednesday, October 17, 2007 9:31:30 AM
Rank: Administration
Groups: Administration

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

The TreeView will never raise an item click event on right click. "Click" is defined as left click. The TreeView has built-in context menu support:

http://www.essentialobjects.com/Demo/Default.aspx?path=TreeView\_i1\_i9

Thanks
tresa
Posted: Wednesday, October 17, 2007 9:41:47 AM
Rank: Newbie
Groups: Member

Joined: 10/12/2007
Posts: 8
yeah.
i have built the context menu on the right click of the tree. But I need to also send the node value of the node being clicked on the right click to the context menu. How do I go about it?

eo_support
Posted: Wednesday, October 17, 2007 9:51:32 AM
Rank: Administration
Groups: Administration

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

The node that were right clicked is already passed to your context menu handler as the third parameter:

http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.Global.treeview_contextmenu_handler.html

So you can just get the node value from that parameter.

Thanks
tresa
Posted: Wednesday, October 17, 2007 11:26:25 AM
Rank: Newbie
Groups: Member

Joined: 10/12/2007
Posts: 8
Hi,
Could you elaborate your point?
Just adding my context menu structure and the tree view structure

So do I get the node value as "node.value" in the context menu?
/* This is my context menu*/
function ShowContextMenu(e, treeView, node)
{

{
if (node.getLevel() == 1)

Dim node_value=node.value
eo_ShowContextMenu(e, "ContextMenu1");


else
if(node.getLevel()==2)
eo_ShowContextMenu(e, "ContextMenu2");
}
return true;

/*The tree structure for the Tree view*/

<eo:TreeView ID="TreeView3" runat="server" Height="100%" Width="100%" RaisesServerEvent="true">
<LookNodes>
<eo:TreeNode ItemID="Student">
</eo:TreeNode>
</LookNodes>
<TopGroup>
<Nodes>
<eo:TreeNode Text="Counsellor">
</eo:TreeNode>
</Nodes>
</TopGroup>
</eo:TreeView>
</td>
<td>











eo_support
Posted: Wednesday, October 17, 2007 11:33:44 AM
Rank: Administration
Groups: Administration

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

It's a two step process. First of all you have to give each node a "Value". It won't just come out of blue. You can either give it by setting the node's Value property, or do it through data binding. Please refer to the documentation for details if you want to do it through data binding.

The second step is to get it on the client side. On client side, you should use .getValue() instead of ".value" to get the value. As a general guide line, you always want to rely on "Client API Reference" to find out what's in there and what's not there. Things won't be there just because you thought it would be, so you have to rely on the documentation there.

Thanks


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.