Radcombobox witth checkboxes

4 posts, 0 answers
  1. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 11 Mar 2015 Link to this post

    I have a radcombobox with checkboxes. It has a javascript that has to enable another textbox depending on the value of selected item.
    The javascript is called when the checkbox is selected but it does not find selected items first time.
    when we click second time it finds only the first one. And so on.

    I have a code snippet to reproduce this issue. This used to work before I installed updates.
    2015.1.225.40 installed.

    I am using C# 2012
    .net vesrion 4.5

    In this code snippet, I am updating  the value of label. The Label shows the values of selected items '-' seperated.
    So first time if I select 44 (value 4)  .... The Label shows nothing
    then if I select 11(value 1)  .... The Label shows -4
    then if I select 77(value 7)  .... The Label shows   -1- 4 
    and so on.

    I hope I have explained my scenario good enough. Please let me know if you need any more clarification.
    ------------- Javascript -----------
        function OnNCAAChange(sender, args) {
            var NCAA;
            var Label1;

            NCAA = $telerik.$("[id$='UINCAA']");
            Label1 = $telerik.$("[id$='Label1']");
            Label1[0].textContent = "";
            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) {
                    Label1[0].textContent = Label1[0].textContent + ' - ' +  item.get_value();

    --------- Controls -----------------
     <telerik:RadComboBox runat="server" ID="UINCAA" Width="60%" CheckBoxes="true" EnableCheckAllItemsCheckBox="false"
                                        OnClientItemChecking="OnNCAAChange" Style="z-index: 8100" MaxHeight="240" ItemsPerRequest="10">
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

    --------Codebehind -------------
       protected void Page_Load(object sender, EventArgs e)
            if (!Page.IsPostBack)
                //List<RadComboBoxItem> rcblist;
                //rcblist = GlobalCodes.GetRCBListBySTSVer(GlobalCodes.Database.STS_Congenital, "3.22", "NCAA", false);

                string t = "1";
                for (int i = 1; i < 10; i++ )
                    //RadComboBoxItem hc;
                    RadComboBoxItem rc = new RadComboBoxItem();
                    rc.Text = t + i.ToString();
                    rc.Value = i.ToString();




  2. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 11 Mar 2015 Link to this post

    I noticed something. When we click on the actual checkbox it works fine but when we click on description , the checkbox is selected but the javascript doesn't recognise it.

    Thanks in advance.
  3. Gauri
    Gauri avatar
    32 posts
    Member since:
    Jan 2012

    Posted 13 Mar 2015 Link to this post

    we were using OnClientItemChecking event we should use OnClientItemChecked
    Another solution is
    Instead of
     var checkbox = item.get_checkBoxElement();
               if (checkbox.checked) {
    if(args.get_item().get_checked() == true)

    fixes it while using OnClientItemChecking item
  4. Ivan Danchev
    Ivan Danchev avatar
    1693 posts

    Posted 16 Mar 2015 Link to this post


    I'm glad you found a solution.

    The OnClientItemChecking event is fired before the items is checked, so, as you found out yourself, the OnClientItemChecked event handler is where you can check if a particular item has been checked and react accordingly.

    Ivan Danchev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top