This is a migrated thread and some comments may be shown as answers.

Show contextmenu when hovering on node instead of right-click

7 Answers 373 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Tommy
Top achievements
Rank 1
Tommy asked on 11 May 2009, 04:27 PM
I implemented the context menu for the treeview and everything works fine.  No my client wants me to show the context menu when hovering vs making the user rightclick, like the HoverMenu is in the Ajax Control Toolkit


Is there another way to open the ContextMenu?   Hopefully there is a Javascript function that I can call to show it for each node.  

thanks
tommy


 

7 Answers, 1 is accepted

Sort by
0
Tommy
Top achievements
Rank 1
answered on 11 May 2009, 05:36 PM
Any ideas?
0
Tommy
Top achievements
Rank 1
answered on 12 May 2009, 02:40 PM
I successfully implemented the AJAX Control Toolkit Hover extender in the NodeTemplate, and my client likes it.  However, I would still like to get the convext menu to display when hovering over a node, vs having to rightclick - I believe that is a cleaner solution in the long run.

does anyone have any ideas on this?
0
Veselin Vasilev
Telerik team
answered on 14 May 2009, 11:25 AM
Hi Tommy,

You can subscribe to the OnClientMouseOver event and show the context menu in its handler as shown below:

<script type="text/javascript"
function onMouseOverHandler(sender, e) 
    sender.showNodeContextMenu(e.get_node(), e.get_domEvent()); 
</script>    



All the best,
Veselin Vasilev
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
Matthew
Top achievements
Rank 1
answered on 07 Dec 2010, 05:12 PM
Is it possible to trigger the node's context menu using a button or imagebutton control within the <NodeTemplate> tags?

I've an image button that I'd like to use within the node template to trigger the context menu, rather than right clicking. So far I've managed to make it so you can left click the node to trigger the menu handing 'OnClientNodeClicking' with this:

function ShowNodeContextMenu(sender, e) {
    e.set_cancel(true);
    sender.showNodeContextMenu(e.get_node(), e.get_domEvent()); 
}

0
Yana
Telerik team
answered on 10 Dec 2010, 09:22 AM
Hi Matthew,

Please check this demo - it demonstrates how to open context menu while hovering elements.

Regards,
Yana
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Matthew
Top achievements
Rank 1
answered on 13 Dec 2010, 01:34 PM
That doesn't work unfortunatly. I can use the function in that demo (showMenu(e))to make the context menu appear when clicking a link button within the '<NodeTemplate>', however none of the items in the menu function, the 'OnClientContextMenuItemClicking' event for the radTree doesn't fire.

I think I need some way of triggering the 'showNodeContextMenu' function instead, when left clicking on a control within the <NodeTemplate>.


In an ideal world, there needs to be a 'Targets' collection within the RadTree's '<ContextMenu>' markup, so I can specify controls within the nodetemplate that trigger a menu.
0
Yana
Telerik team
answered on 21 Dec 2010, 09:36 AM
Hi Matthew,

Could you please send us the exact definition of your treeview? Thanks

Best wishes,
Yana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
TreeView
Asked by
Tommy
Top achievements
Rank 1
Answers by
Tommy
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Matthew
Top achievements
Rank 1
Yana
Telerik team
Share this question
or