I'm trying to populate a RadComboBox on the client side with values from an array. Here's the markup I'm using for the control:
The rest of the page doesn't matter. It's just in a simple HTML page. Here's the javascript code I'm using to add items:
arrSerials contains a list of serials that the user has input through a text box. Each are string values for the serial number.
And here's the issue. The second time through this loop, the AddSerial function throws an exception on the combo.get_items().add(comboItem); line
The error I'm seeing is: Object doesn't support this property or method.
Debugging halts on the bolded line in this function from Telerik:
_removeEmTags:function(text){
var _1b2=text.indexOf("<em>");
var _1b3=text.indexOf("</em>");
if(_1b2>=0&&_1b3>_1b2){
text=String.format("{0}{1}{2}",text.substr(0,_1b2),text.substr(_1b2+4,_1b3-_1b2-4),text.substr(_1b3+5));
}
return text;
}
Is there some other way I'm supposed to be adding a list of items to the combo box on the client side? Can anyone else reproduce this issue?
Thanks for your time,
Bren
| <telerik:RadComboBox ID="cboSerialNumber" runat="server" /> |
The rest of the page doesn't matter. It's just in a simple HTML page. Here's the javascript code I'm using to add items:
| function InitDetails() |
| { |
| var combo = $find("<%= cboSerialNumber.ClientID %>"); |
| combo.get_items().clear(); |
| for (i = 0; i < arrSerials.length; i++) |
| { |
| AddSerial(arrSerials[i]); |
| } |
| } |
| function AddSerial(num) |
| { |
| var combo = $find("<%= cboSerialNumber.ClientID %>"); |
| var comboItem = new Telerik.Web.UI.RadComboBoxItem(); |
| comboItem.set_text(num); |
| combo.trackChanges(); |
| combo.get_items().add(comboItem); |
| comboItem.select(); |
| combo.commitChanges(); |
| } |
arrSerials contains a list of serials that the user has input through a text box. Each are string values for the serial number.
And here's the issue. The second time through this loop, the AddSerial function throws an exception on the combo.get_items().add(comboItem); line
The error I'm seeing is: Object doesn't support this property or method.
Debugging halts on the bolded line in this function from Telerik:
_removeEmTags:function(text){
var _1b2=text.indexOf("<em>");
var _1b3=text.indexOf("</em>");
if(_1b2>=0&&_1b3>_1b2){
text=String.format("{0}{1}{2}",text.substr(0,_1b2),text.substr(_1b2+4,_1b3-_1b2-4),text.substr(_1b3+5));
}
return text;
}
Is there some other way I'm supposed to be adding a list of items to the combo box on the client side? Can anyone else reproduce this issue?
Thanks for your time,
Bren