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

[Solved] add items on client

3 Answers 188 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Michael Tissington
Top achievements
Rank 1
Michael Tissington asked on 10 Dec 2007, 07:13 PM
I get an error when trying to add more than one item to the combo.

Microsoft JScript runtime error: 'get_childListElement()' is null or not an object

My code is like the following

...
rcb.trackClientChanges();
items = rcb.get_items();
items.clear();
newItem = new Telerik.Web.UI.RadComboBoxItem();
newItem.set_text("yesterday");
items.add(newItem);
newItem.set_text("today");
items.add(newItem);
rcb.commitClientChanges();
...

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 11 Dec 2007, 08:11 AM
Hi Michael Tissington,

The problem is that you add the same item twice. You should create a new item and add it like:

 var rcb = $find("<%=RadComboBox1.ClientID %>"); 
            rcb.trackClientChanges(); 
            items = rcb.get_items(); 
            items.clear(); 
            newItem = new Telerik.Web.UI.RadComboBoxItem(); 
            newItem.set_text("yesterday"); 
            items.add(newItem); 
             
            newItem1 = new Telerik.Web.UI.RadComboBoxItem(); 
            newItem1.set_text("today"); 
            items.add(newItem1); 
             
            rcb.commitClientChanges(); 

Hope this helps.

Best wishes,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael Tissington
Top achievements
Rank 1
answered on 11 Dec 2007, 05:48 PM
This does not help, I get the same error. I can only add one item.
0
Nikolay
Telerik team
answered on 12 Dec 2007, 01:39 PM
Hi Michael Tissington,

Attached, please find a small and running project on the matter.

Please download the files and give them a go.

Hope this helps.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox
Asked by
Michael Tissington
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Michael Tissington
Top achievements
Rank 1
Share this question
or