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

Confirmation before drop

2 Answers 80 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Steven Black
Top achievements
Rank 1
Steven Black asked on 20 Apr 2009, 03:23 PM
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 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 20 Apr 2009, 03:48 PM
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.
0
Steven Black
Top achievements
Rank 1
answered on 24 Apr 2009, 02:59 AM
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.

Tags
TreeView
Asked by
Steven Black
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Steven Black
Top achievements
Rank 1
Share this question
or