How to prevent NodeDrop event fire before RadAjaxManager1_AjaxRequest

3 posts, 0 answers
  1. Huy
    Huy avatar
    12 posts
    Member since:
    Jun 2012

    Posted 29 Oct 2014 Link to this post

    I have a page with Radtreeview enable drag & drop. I implement a radconfirm to check exist node name when drop nodes

    Script on client node dropping

     
    function onNodeDropping(sender, args) {
               var dest = args.get_destNode();
               var source = args.get_sourceNode();
               if (dest) {
                   var result = false;
                   for (var i = 0; i < dest.get_nodes().get_count() ; i++) {
                       var node = dest.get_nodes().getNode(i);
                       if (node.get_text() == source.get_text()) {
                           result = true;
                           break;
                       }
                   }
                   if (result) {
                       callConfirm(source.get_text());
                       return;
                   }
               }
               else {
                   dropOnHtmlElement(args);
               }
           }

    And code to call confirm :

    function callConfirm(nodeText) {
                            radconfirm(nodeText + ' folder is existing, Do you want to overwrite?', confirmCallBackFn);
                            return false;
                        }
                        function confirmCallBackFn(arg) {
                            var ajaxManager = $find("<%=RadAjaxManager1.ClientID%>");
                       if (arg) {
                           ajaxManager.ajaxRequest('ok');
                       }
                       else {
                           ajaxManager.ajaxRequest('cancel');
                       }

    Code of RadAjaxManager1_AjaxRequest
    if (e.Argument.ToString() == "ok")
                {
                    lbStatus.Text = "OK";
                }
                else if(e.Argument.ToString() == "cancel")
                {
                    lbStatus.Text = "Cancel";
                }

    But when drop an item on Radtreeview to another Node that the same node name, RadTreeView_NodeDrop event always fire before RadAjaxManager1_AjaxRequest. How to solve it?


  2. Huy
    Huy avatar
    12 posts
    Member since:
    Jun 2012

    Posted 29 Oct 2014 in reply to Huy Link to this post

    Update: Confirmbox show on the same time with RadTreeView_NodeDrop event fire.

    I want them follow with sequence :
    User drag item to others node > if it has same node name > show confirm box > User choose Yes or No > fire event RadAjaxManager1_AjaxRequest > fire event RadTreeView_NodeDrop

    But current sequence is :User drag item to others node > same node name > show confirm box + fire event RadTreeView_NodeDrop
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 03 Nov 2014 Link to this post

    Hi Huy,

    I suggest you cancel the OnClientNodeDropping event in case the user click on the "Cancel" button in the radconfirm window. This way you will no longer need OnAjaxRequest event and you can move your server logic in the RadTreeView_NodeDrop event and

    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top