Welcome Guest Search | Active Topics | Sign In | Register

Treeview Context menu Options
nick mcculloch
Posted: Tuesday, October 21, 2008 6:20:02 AM
Rank: Member
Groups: Member

Joined: 10/16/2008
Posts: 10
As I am still investigating this control I have the following question regarding a Context menu displaying as part of the Treeview.

I can get the context menu to display, but, how do I raise an event to be handled server-side based on the action clicked in the context menu? Basically, if I am maintaining a Company Structure, I want to go right mouse button, select "create item below xxxxx'. When clicked this would raise a server side event to pre-populate (and make visible) a user control which can accept the form items to create the "child". How do I do this?

Nick
eo_support
Posted: Tuesday, October 21, 2008 6:34:22 AM
Rank: Administration
Groups: Administration

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

You would set the ContextMenu control's RaisesServerEvent to true. That way when you click a context menu item, the page will post back and raises the ContextMenu's ItemClick event.

Inside your ContextMenu's ItemClick event handler, you would:

1. Use the event argument to find out which ContextMenu item was clicked;
2. Use TreeView's ContextNode to find out which node the context menu was displayed upon;

So if you right click on node "ABC company", then choose "Create item" from the context menu, inside your ContextMenu's ItemClick event, the event argument will tell you that you clicked "Create item" menu item, and the TreeView's ContextNode will give you "ABC company". You can then carry on whatever logics based on those information.

Hope this helps.

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.