get checkbox value client side from multi column

3 posts, 0 answers
  1. Kieran
    Kieran avatar
    23 posts
    Member since:
    Feb 2009

    Posted 15 Oct 2010 Link to this post

    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. Yana
    Admin
    Yana avatar
    4890 posts

    Posted 21 Oct 2010 Link to this post

    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
  3. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 28 Jun 2013 Link to this post

     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.
Back to Top