Telerik: RadComboBox How do delete all the items and add a new list -
i using telerik radcombobox drop down list inside user control in web forms application. need delete items in box, let's id ddlveihiclemake , repopulate new list of item passed function. here example of understand should like,
function addnewitems(selectref, optionsarray, valuesarray) { var combo = document.getelementbyid("ctl00_cpmain_ctl01_appradpaneltabvehicleinformation_i0_i0_tabvehicleinformation_ddlvehiclemake_input"); combo.get_items().clear(); (var idx = 0; idx < optionsarray.length; idx++) { if (valuesarray == "") { var comboitem = new telerik.web.ui.radcomboboxitem(); comboitem.set_text(optionsarray[idx]); combo.trackchanges(); combo.get_items().add(comboitem); } else { var comboitem = new telerik.web.ui.radcomboboxitem(); comboitem.set_text(optionsarray[idx]); combo.trackchanges(); combo.get_items().add(comboitem); } }
it fails me on get_items().clear() , get_itmes().add(comboitem). appreciate can get.
thanks!
try this:
function deleteitems(sender, args) { var combo = window.$find("<%= cbomycombobox.clientid %>"); combo.trackchanges(); (var = 0; < combo.get_items().get_count(); i++) { combo.get_items().remove(combo.get_items().getitem(i)); } combo.commitchanges(); }
Comments
Post a Comment