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

get checkbox value client side from multi column

2 Answers 123 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kieran
Top achievements
Rank 1
Kieran asked on 15 Oct 2010, 11:32 PM
Hi

I have a multi column combo defined. One column contains standard checkboxes (<input type=checkbox>) How do I get at these checkboxes and their checked state, and indeed for that matter, any value or object in a multi column combo box using javascript?

Any pointers appreciated

Many thanks

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 21 Oct 2010, 01:54 PM
Hello Kieran,

Here is a sample code for this:

<telerik:RadComboBox ID="RadComboBox1" runat="server" AllowCustomText="true" Width="240px">
    <ItemTemplate>
        <div>
            <input type="checkbox" checked="checked" id="chk1">
            <asp:Label runat="server" ID="Label1">
                 <%#DataBinder.Eval(Container, "Text")%>            
            </asp:Label>
        </div>
    </ItemTemplate>
</telerik:RadComboBox>

you can get the checkbox and label on the client like this:

var comboBox = $find("<%=RadComboBox1.ClientID %>");
for (var i = 0; i < comboBox.get_items().get_count(); i++) {
    var item = comboBox.get_items().getItem(i);
    var checkbox = $telerik.findElement(item.get_element(), "chk1");
    alert(checkbox.checked);
    var label = $telerik.findElement(item.get_element(), "Label1")
    alert(label.innerHTML);
}

Hope this helps.

Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Gauri
Top achievements
Rank 1
answered on 28 Jun 2013, 01:28 PM
 for (var i = 0; i < sender.get_items().get_count(); i++) {
        var item = sender.get_items().getItem(i);
        var checkbox = item.get_checkBoxElement();
        if (checkbox.checked) {
}}

I hope this will save someone's time.
Tags
ComboBox
Asked by
Kieran
Top achievements
Rank 1
Answers by
Yana
Telerik team
Gauri
Top achievements
Rank 1
Share this question
or