Hi,
I would like to be able to open a context menu when the Client-Side event "OnClientNodeDropped" is fired. From this I would like the user to be able to choose an item from the context menu.
So, server side I would like to get:
What choice was made on the context menu
What is the destination node
What is the source node
I realise a similar question has been asked, (http://www.telerik.com/community/forums/aspnet-ajax/treeview/contextmenu-on-onnodedropping-event.aspx), however, this was posted more than a year ago.
Is there anyway to achieve this result?
Thank you for your time,
Adam
5 Answers, 1 is accepted
0
Accepted
Hi Adam,
I've attached a simple page demonstrating the needed approach, please download it and give it a try.
Kind regards,
Yana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I've attached a simple page demonstrating the needed approach, please download it and give it a try.
Kind regards,
Yana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Adam Webb
Top achievements
Rank 1
answered on 12 Aug 2009, 02:45 PM
Thank you Yana.
That's fantastic!
Exactly what I was hoping to accomplish.
Kind Regards,
Adam
0

Adam Webb
Top achievements
Rank 1
answered on 13 Aug 2009, 04:29 PM
Dear Yana,
While the zip file you posted previously does work and is greatly appreciated, I have encountered a problem.
It seems to be that once I add a NodeExpand event handler to the tree, the context menu stops showing up when the node is dropped (Or it seems as though it as about to show, and then disappears).
The Nodes are setup so that their expand mode is TreeNodeExpandMode.ServerSideCallBack
Inside the NodeExpand event handler I am adding Child-Nodes to the node which has been expanded. For example something like this:
void RadTreeView1_NodeExpand(object sender, RadTreeNodeEventArgs e) |
{ |
for (int i = 0; i < 5; i++) |
{ |
RadTreeNode node = new RadTreeNode(); |
node.Text = e.Node.Text + "." + i; |
node.Value = e.Node.Value + "." + i; |
node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack; |
e.Node.Nodes.Add(node); |
} |
e.Node.ExpandMode = TreeNodeExpandMode.ClientSide; |
e.Node.Expanded = true; |
} |
Thanks again for your time,
Kind Regards,
Adam
0
Accepted
Hi Adam,
Thank you for getting back to me.
Please modify nodeDropping function like this:
I've also attached the modified page for a reference.
Kind regards,
Yana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thank you for getting back to me.
Please modify nodeDropping function like this:
<script type="text/javascript"> |
function nodeDropping(sender, args) |
{ |
args.set_cancel(true); |
var menu = $find("<%=RadContextMenu1.ClientID %>"); |
menu.trackChanges(); |
menu.get_items().getItem(0).get_attributes().setAttribute("sourceNode", args.get_sourceNode().get_value()); |
menu.get_items().getItem(0).get_attributes().setAttribute("destNode", args.get_destNode().get_value()); |
menu.commitChanges(); |
setTimeout( function() {menu.show(args.get_domEvent())}, 100); |
} |
</script> |
I've also attached the modified page for a reference.
Kind regards,
Yana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Adam Webb
Top achievements
Rank 1
answered on 14 Aug 2009, 01:51 PM
Yana. Thank you! That's fantastic.
Works like a charm.
Kind Regards,
Adam