Problems with dragdrop & radajaxmanager

5 posts, 0 answers
  1. Robin
    Robin avatar
    23 posts
    Member since:
    Oct 2011

    Posted 31 Oct 2012 Link to this post

    I have a tree list where drag/drop is enabled. To do this I set AllowItemsDragDrop to true and added this line
     <ClientEvents OnItemDropping="itemDropping" OnTreeListCreated="function(sender) { treelist1 = sender; }" />

    Method itemDropping verifies if the item being dragged is allowed and if the location where the item is being dropped is allowed. If not, an alert appears and the method returns. If all is ok I use fireCommand to initiate a server side method.

    Since my treelist is ajax enabled the server side method was not triggered. To resolve this I added a ClientEvents-OnRequestStart method to the RadAjaxManager control to determine if the event target is my treelist control. If it is then I have set_enableAjax(false);  The problem with this is that the treelist doesn't refresh after the drop (and my RegisterClientScriptBlock doesn't execute). The odd thing is that if I replace the set_enableAjax(false) in my ClientEvents-OnRequestStart method with an alert('any text will do') then the server side method executes.

    Any thoughts?

    Thanks.
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 05 Nov 2012 Link to this post

    Hello Robin,

    Note that the server side methods should properly executes in case the ajax is enabled. However note that there are some specifics in registering client scripts using server methods when ajax is turned on. Please review the following help topic for more information on this matter:
    http://www.telerik.com/help/aspnet-ajax/ajax-execute-custom-javascript.html

    I hope this helps.

    Kind regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Robin
    Robin avatar
    23 posts
    Member since:
    Oct 2011

    Posted 05 Nov 2012 Link to this post

    No, this did not help. What do you mean by "Note that the server side methods should properly executes in case the ajax is enabled. However note that there are some specifics in registering client scripts using server methods when ajax is turned on."? I already stated that unless I turned off ajax the client side method wasn't executing - at all. I put a break point in the server side method and it was never reached. 

    I could get the server side method to execute if I did 1 of the following 2 things in the ClientEvents-OnRequestStart method for my radajaxmanager control:
    1) turn off ajax for the drag-drop event
    2) issue a client side alert in the drag-drop event -- this one seems weird. why would a javascript alert help trigger the server side method?

                function mngRequestStarted(ajaxManager, eventArgs) {

                    var tmp1 = "rtlPortfolios";
                    if (eventArgs.get_eventTarget().lastIndexOf("rtlPortfolios") + tmp1.length == eventArgs.get_eventTarget().length) {
                        var tmp2 = document.getElementById("hiddenCurrentMove").value;
                        if (tmp2 == "dragDrop") {
                            //  alert('moving');    IF UNCOMMENT THIS LINE AND COMMENT OUT set_enableAjax(false) SERVER SIDE EXECUTES
                            tmp2.valueOf = "";
                           // eventArgs.set_enableAjax(false); IF UNCOMMENT THIS LINE AND COMMENT OUT alert SERVER SIDE EXECUTES

                        }
                    }
                    if (eventArgs.get_eventTarget().indexOf("btnExportUsers") != -1) {
                        eventArgs.set_enableAjax(false);
                    }
                }
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 08 Nov 2012 Link to this post

    Hello Robin,

    By saying that the server side methods of the RadTreeList should properly fire no matter if ajax is enabled I mean that the ajaxification of the control would not prevent the server side methods to work correctly. Therefore I'm not completely sure what exactly is causing the issue on your end. It will be best if you could open a regular support ticket adn send us sample runnable version of your application which demonstrates the problematic beahvior, Thus we will be bale to test it locally and advise you further.
    Meanwhile you could review the online demo below which demonstrates the correct behaviour of DragDrop functionality in ajaxified TreeList control:
    http://demos.telerik.com/aspnet-ajax/treelist/examples/itemsdragdrop/defaultcs.aspx

    Regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Robin
    Robin avatar
    23 posts
    Member since:
    Oct 2011

    Posted 08 Nov 2012 Link to this post

    Will do.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017