I have a Combo Box which I am trying to use to drop down a CheckBoxList control, which the user can make multiple selections. I have an onclick event on each of the checkboxes, and in that event handler I am trying to get a reference to the checkboxlist. In the code behind, I attach the event handler by doing
checkbox.Attributes.Add(
"onclick", "doPropertyClick()")
for each checkbox. In the handler, I am trying to get a reference to the checkbox list below, but I do not know how to find the checkbox control within the template item on the client side.
function doPropertyClick() {
var count = 0
var txt = ""
var combo = $find("ddlProperties")
var cbxList = combo.get_items().getItem(0)
var arrayOfCheckBoxes = cbxList.childNodes
for(var i=0;i<arrayOfCheckBoxes.length;i++) {
count = count + 1
txt = arrayOfCheckBoxes[i].text
}
if (count > 1) {
txt =
"Multiple Selected"
}
setTimeout(
function() { $find("ddlProperties").set_text(txt); }, 100);
}
The declaration for the control is below.
<
telerik:RadComboBox ID="ddlProperties" runat="server">
<ItemTemplate>
<asp:CheckBoxList ID="cbxProperties" runat="server" RepeatLayout="Flow">
</asp:CheckBoxList>
</ItemTemplate>
<Items>
<telerik:RadComboBoxItem />
</Items>
</telerik:RadComboBox>