Drag & Drop and Context Menus - Menu Won't Stay OPen

3 posts, 0 answers
  1. Bryan
    Bryan avatar
    2 posts
    Member since:
    Apr 2016

    Posted 28 Apr 2016 Link to this post

    I am doing a drag and drop from a grid onto the treeview. All is well, events are hooking up and I am getting all the data I need to make it work. But I have one issue. After the row from the grid is dragged on to the treeview node, I display a context menu that will allow the user to select the action they would like to perform with the dragged item on the node.

    I have the context menu showing in the correct place, however it quickly closes again so that the user cannot select any of the menu items.

    The code which show the menu:

      function onRowDropping(sender, args) {
                    if (currentNode) {
                        //Check to see if this is a valid drop
                        var draggedrow = args.get_draggedItems()[0];
                        var dragedentitytype = draggedrow.getDataKeyValue('EntityID');
                        var dragentityid = draggedrow.getDataKeyValue('cplID');
                        var dropenitytype = currentNode.get_attributes().getAttribute('EType');
                        args.set_cancel(true); //Cancel the drop, will be handled by menu item, also prevent grid from auto refreshing
                        var tree = $find("<%=RadTreeStandards.ClientID %>");
                        tree._contextMenuNode = currentNode;
                        var menu = tree.get_contextMenus()[1];
                    else {
                var currentNode = null;
                function onNodeMouseOver(sender, args) {
                    //gets the node upon mousing over the node
                    currentNode = args.get_node();
                function onNodeMouseOut(sender, args) {
                    //resets the currentNode value upon mousing out
                    currentNode = null;


    It seems that some event is occurring that I can't cancel that closes the menu?


    Bryan Kowalchuk



  2. Veselin Tsvetanov
    Veselin Tsvetanov avatar
    877 posts

    Posted 03 May 2016 Link to this post

    Hello Bryan,

    I would suggest you to place the menu.show() call in a timeout:
    setTimeout(function () {
    }, 100);

    This should solve the issue as the drop of the grid row itself forces the context menu to be closed. Using timeout will delay the showing after the drop event.

    Veselin Tsvetanov
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. Bryan
    Bryan avatar
    2 posts
    Member since:
    Apr 2016

    Posted 04 May 2016 Link to this post

    Worked great, fixed the problem.

    Thanks for the reply.


Back to Top