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
|
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!
|