Confirmation before drop

3 posts, 0 answers
  1. Steven Black
    Steven Black avatar
    44 posts
    Member since:
    Feb 2008

    Posted 20 Apr 2009 Link to this post

    Hello,

    I have two radTreeViews in a user control.  I am allowing the user to drag and drop nodes from either TreeView to the other.  Before the drop occurs though, I want to prompt the user with a confirmation message.  Something like "Are you sure you want to do this?".  If the user selects "No" (or "Cancel"), the Drag/Drop is cancelled.

    I found a post regarding intercepting the postback from a button using GetPostBackEventReference in the callback function of radConfirm, and I've used that separately successfully in my application.  However, that was used from within an aspx page and not a user control, and of course it was as button and not a TreeView.  I tried to duplicate that functionality with the TreeView, but it's not working.  I can't even compile because I'm getting a message saying that "GetPostBackEventReference is not declared".  My guess is that this error is occuring because I'm in a user control and not a web page, but as I said that is just a guess.

    Any help would be appreciated.

    Thanks.

    PS.  Just some further information.  The user control will reside inside a Content Page.  Within my Master Page I have the ContentPlaceHolder wrapped inside an AjaxPanel.  This is probably not the most efficient way of ajaxifying my application, but it seems to be working just fine so far. 
     
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Apr 2009 Link to this post

    Hi Steven Black,

    I suggest you check the OnClientNodeDropping event. It can be canceled if certain condition is met. However you cannot use RadToolTip in this case. You should use the built-in confirm JavaScript function:

    function nodeDropping(sender, args)
    {
        if (!confirm("Are you sure?"))
        {
              args.set_cancel(true); //prevent drag and drop.
        }
    }

    Regards,
    Albert
    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.
  3. Steven Black
    Steven Black avatar
    44 posts
    Member since:
    Feb 2008

    Posted 23 Apr 2009 Link to this post

    Thank you for the response.  I got sidetracked on a couple of other issues and haven't had a chance to try this out yet.  I will let you know if I have any problems.

Back to Top