Getting Script error on transferring all to right

6 posts, 0 answers
  1. Chirag
    Chirag avatar
    3 posts
    Member since:
    Dec 2011

    Posted 19 Dec 2011 Link to this post

    Hello,

    I have used the Listbox with Drag and Drop functionality. 

    My problem is that listbox contains the lots of data and when I click on "All to Right"  button it gives an error like:
    "A script on this page is causing your web browser to run slowly.  If it continues to run, your computer might become unresponsive."

    Also we dont want to use the Load on Demand facility.

    I have attached the screen shot of the Error.

    Thanks
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 20 Dec 2011 Link to this post

    Hi Chirag,

    In case you have large amount of items and you want to transfer them all, this operation  requires a lot of java script to be executed and in some older browsers like IE8 which is rather slow in terms of java script execution such problem might occur.

    Could you specify the amount of items that you are transferring and in which browser such error occurs.

    Best wishes,
    Dimitar Terziev
    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. Chirag
    Chirag avatar
    3 posts
    Member since:
    Dec 2011

    Posted 20 Dec 2011 Link to this post

    Hi Dimitar Terziev,

    Thank you for your reply.

    We have a data more than 3,000 and getting Script error in "IE8", "FF8".

    Regards
    Chirag


  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 22 Dec 2011 Link to this post

    Hello Chirag,

    Could you specify the version of the controls that you are using? In general the transfer of more than 3000 items is quite time and resource consuming operation and it might produce such error if the browser could not handle the java script execution.

    Regards,
    Dimitar Terziev
    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. Chirag
    Chirag avatar
    3 posts
    Member since:
    Dec 2011

    Posted 28 Dec 2011 Link to this post

    Hello Dimitar Terziev,

    We are using the Telerik version - 2011.1.413.35

    Regards,
    Chirag
  7. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 03 Jan 2012 Link to this post

    Hello Chirag,

    As Dimitar said, when a javascript function runs for an extended amount of time, it causes the browsers to react in this way, for security and usability reasons. As a workaround, I can offer you the following solution:

    1. Add a handler to the OnClientLoad event of the source listbox.
    2. In the handler, add the following code:

    function clientLoad(sender) {
        var listbox = sender;
     
        sender._onTransferAllClick = function(sourceListBox, destinationListBox, e) {
            if (sourceListBox.get_transferMode() == Telerik.Web.UI.ListBoxTransferMode.Move && !listbox.get_autoPostBackOnTransfer())
                sourceListBox.clearSelection();
     
            var itemArrayCopy = sourceListBox.get_items()._array.slice(0, 100);
            listbox._transfer(itemArrayCopy, sourceListBox, destinationListBox, 0, e, Telerik.Web.UI.ListBoxCommand.TransferAll);
     
            if (sourceListBox.get_items().get_count() == 0)
                return;
                   
            if (listbox == sourceListBox)
                setTimeout(function() { $telerik.$(".rlbTransferAllFrom").click(); }, 50);
            else
                setTimeout(function() { $telerik.$(".rlbTransferAllTo").click(); }, 50);
        }
    }

    You can select the number of items transferred at each iteration to the number that best suites your needs. Just change the second number in the Slice function. Also, you can adjust the timeout value in the bottom two jQuery functions, if the code isn't working properly at your end.

    Regards,
    Bozhidar
    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017