I'm adding items to a RadListBox on the client side and would like to know if there was an easy way to conditionally set a CSS class.
Currently I must insert each item and then call the get_element method on the RadListBoxItem.
Ideally I would like to be able to set the CSS class on the RadListBoxItem, add it to a collection, and then use the ListBox's insertItems method to do a batch insert.
Heres an idea of what I'm doing now.
Edit: Added some code
Currently I must insert each item and then call the get_element method on the RadListBoxItem.
Ideally I would like to be able to set the CSS class on the RadListBoxItem, add it to a collection, and then use the ListBox's insertItems method to do a batch insert.
Heres an idea of what I'm doing now.
function
employeePickerOnSuccessCallBack(employeeInfo) {
var
listbox = $find(<%= RadListBox1.ClientId %>);
listbox.trackChanges();
var
item =
new
window.Telerik.Web.UI.RadListBoxItem();
item.set_text(employeeInfo.name);
item.set_value(employeeInfo.value);
listbox.get_items().add(item);
if
(!employeeInfo.IsActive) {
var
liElement = item.get_element();
$(liElement).addClass(
"inactive"
);
}
listbox.commitChanges();
}
Edit: Added some code