These methods are in the documentation, but when I try to use them, I get an error that they are undefined. Breaking within my javascript reveals that they in fact do NOT exist. How does one determine whether or not an item is already in the RadListBox on the client-side?
My code is below. rlbOtherCSRs is a RadListBox and rcbOtherCSRs is a RadComboBox. I'm trying to copy the item from the combo box to the list box, but only if the list box doesn't already have it.
My code is below. rlbOtherCSRs is a RadListBox and rcbOtherCSRs is a RadComboBox. I'm trying to copy the item from the combo box to the list box, but only if the list box doesn't already have it.
function AddOtherCSRClick() { |
var rcbOther = $find("<%= rcbOtherCSRs.ClientID %>"); |
var rlbOther = $find("<%= rlbOtherCSRs.ClientID %>"); |
if (rcbOther.get_selectedIndex() > 0) { |
var selected = rcbOther.get_selectedItem(); |
var existingitem = rlbOther.findItemByValue(selected.get_value()); |
if (!existingitem) { |
var newitem = new Telerik.Web.UI.RadListBoxItem(); |
newitem.set_value(selected.get_value()); |
newitem.set_text(selected.get_text()); |
rlbOther.trackChanges(); |
rlbOther.get_items().add(newitem); |
newitem.select(); |
rlbOther.commitChanges(); |
} |
} |
} |