I have this code in the click event of the checkbox to set the text of the combo:
function
stopPropagation(e)
{
e.cancelBubble =
true;
if (e.stopPropagation)
{
e.stopPropagation();
}
var combo = $find("<%= RadComboBoxType.ClientID %>");
var selectedItemsTexts = "";
var selectedItemsValues = "";
var items = combo.get_items();
for (var i = 0; i < items.get_count(); i++)
{
var item = items.getItem(i);
var checkbox = item.get_element().getElementsByTagName("input")[0];
if (checkbox.checked)
{
selectedItemsTexts += item.get_text() +
", ";
selectedItemsValues += item.get_value() +
", ";
}
}
selectedItemsTexts = selectedItemsTexts.substring(0, selectedItemsTexts.length - 2);
selectedItemsValues = selectedItemsValues.substring(0, selectedItemsValues.length - 2);
combo.set_text(selectedItemsTexts);
//Clear the selection that RadComboBox has made internally.
if (selectedItemsValues == "")
{
combo.clearSelection();
}
}
I have multiple multi-select combos on my page and therefore I want to identify the sender combo and set text in that combo accordingly, instead of hardcoding the RadComboBox name.
How can I do that?