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

Getting Script error on transferring all to right

5 Answers 69 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Chirag
Top achievements
Rank 1
Chirag asked on 19 Dec 2011, 01:19 PM
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

5 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 20 Dec 2011, 10:25 AM
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
0
Chirag
Top achievements
Rank 1
answered on 20 Dec 2011, 02:52 PM
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


0
Dimitar Terziev
Telerik team
answered on 22 Dec 2011, 03:41 PM
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
0
Chirag
Top achievements
Rank 1
answered on 28 Dec 2011, 12:37 PM
Hello Dimitar Terziev,

We are using the Telerik version - 2011.1.413.35

Regards,
Chirag
0
Bozhidar
Telerik team
answered on 03 Jan 2012, 10:55 AM
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
Tags
ListBox
Asked by
Chirag
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Chirag
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or