Show contextmenu when hovering on node instead of right-click

8 posts, 0 answers
  1. Tommy
    Tommy avatar
    6 posts
    Member since:
    Mar 2009

    Posted 11 May 2009 Link to this post

    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


     
  2. Tommy
    Tommy avatar
    6 posts
    Member since:
    Mar 2009

    Posted 11 May 2009 Link to this post

    Any ideas?
  3. Tommy
    Tommy avatar
    6 posts
    Member since:
    Mar 2009

    Posted 12 May 2009 Link to this post

    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?
  4. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 14 May 2009 Link to this post

    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.
  5. Matthew
    Matthew avatar
    16 posts
    Member since:
    Dec 2010

    Posted 07 Dec 2010 Link to this post

    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()); 
    }

  6. Yana
    Admin
    Yana avatar
    4914 posts

    Posted 10 Dec 2010 Link to this post

    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.
  7. Matthew
    Matthew avatar
    16 posts
    Member since:
    Dec 2010

    Posted 13 Dec 2010 Link to this post

    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.
  8. Yana
    Admin
    Yana avatar
    4914 posts

    Posted 21 Dec 2010 Link to this post

    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.
Back to Top