This is a migrated thread and some comments may be shown as answers.

Templates on client side

2 Answers 90 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Andrew Short
Top achievements
Rank 1
Andrew Short asked on 11 Jul 2008, 03:02 PM

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>

2 Answers, 1 is accepted

Sort by
0
Andrew Short
Top achievements
Rank 1
answered on 11 Jul 2008, 10:37 PM
I have found a solution for the initial problem, but I have another issue.  How can I prevent the RadComboBox from closing when an item is selected. In my example, I have a CheckBoxList as a template item in which I want the user to be able to make multiple selections at once.
0
Veselin Vasilev
Telerik team
answered on 14 Jul 2008, 07:07 AM
Hello Andrew Short,

I suggest that you check the approaches here and here.

Let us know if you still experience any problems.

All the best,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox
Asked by
Andrew Short
Top achievements
Rank 1
Answers by
Andrew Short
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or