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

Error in IE8 with insertItems when inserting lots of items

3 Answers 64 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
jon *
Top achievements
Rank 1
jon * asked on 08 Dec 2009, 06:31 PM
Hello,

I am using RadControls for ASP.NET AJAX v2009.2.1028.35.

I am having this weird error in IE8 (I tested so far also in Chrome and no error) when using insertItems method:

Line: 2423
Error: 'this._element' is null or not an object

but it happens only when I am inserting lots of items (starting at ~ 4000). Anyway, after this error, the items are properly inserted.

Can you help me on this please?

Thank you very much for your products and support!

3 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 11 Dec 2009, 09:16 AM
Hello jon *,

 I have tried inserting 6000 items and there is no error present. Can you provide us with your insert method? 

I have tried to insert the items the following way:

function AddItem() {
            var items = [];
            for (var i = 0; i < 6000; i++) {
                var item = new Telerik.Web.UI.RadListBoxItem();
                item.set_text(i);
                items[i] = item;
            }
 
            var listBox = $find("RadListBox1");
            listBox.insertItems(items);
        }

Does this code produces error on your side?

Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
jon *
Top achievements
Rank 1
answered on 11 Dec 2009, 11:54 AM
Hello, thank you for your answer.

Your code is working without errors on my side.

Here is my code - basically I am adding tree nodes into a list box:
 function addUserNodes(nodesList) { 
            var childNode; 
            var itemForDst; 
            var itemCollection = []; 
            for (var i = 0; i < nodesList.get_count(); i++) { 
                itemForDst = new Telerik.Web.UI.RadListBoxItem(); 
                childNode = nodesList.getNode(i); 
                itemForDst.set_value(childNode.get_value()); 
                itemForDst.set_text(childNode.get_text()); 
                itemCollection[i] = itemForDst; 
            } 
            lbxDst.insertItems(itemCollection); 
        } 

I did some tests:
- All these tree nodes render fine in the treeview without error.
- My function does not produce errors if I use another text for the RadListBoxItem (eg: itemForDst.set_text(i); ).
- Also, all my childNode.get_text() return a non-null and non-empty string.

So I think there is a problem with my text I try to set, although I apply HttpUtility.HtmlEncode on these strings before passing them client side.

Any suggestions?

Thank you in advance guys.
0
Genady Sergeev
Telerik team
answered on 16 Dec 2009, 01:34 PM
Hi jon *,

Can you send us the strings that you use along with the code that you use to encode them. It would be best if you have a running sample reproducing the problem. Up to now we haven't heard of similar problem regarding the listbox, therefore we need some additional information in order to research the problem.


Best wishes,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ListBox
Asked by
jon *
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
jon *
Top achievements
Rank 1
Share this question
or