Combo box click issue

4 posts, 0 answers
  1. RK
    RK avatar
    4 posts
    Member since:
    Feb 2014

    Posted 12 Feb 2014 Link to this post

    In Combo box options, when I click on empty space on the dropdown items (other than checkbox and label) the item text is showing in the textbox eventhough check box is not selected.
    Added image for your reference.
    And I tried to find the length of the checked items while drop down closed and if its 0 then am manually clearing out the textbox control.
    Saying that, checked item length is always returns 0.
    Code for your reference.

    function OnClientDropDownClosing(sender, eventArgs) {
                var combo = $find("<%= rcbPatientType.ClientID %>");
                    if (combo.get_checkedItems().length < 1) {
    In the image you can see the spot I have marked where I click, at that time 'All ' checkbox is not checked but its shown in textbox
    Now what I want is, either click on empty space should not work otherwise the item checkbox should be checked on clicking the equivalent empty space
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Feb 2014 in reply to RK Link to this post


    Please have a look into the sample code snippet which works fine at my end.

    <telerik:RadComboBox ID="RadComboBox1" runat="server"                   OnClientDropDownClosing="OnClientDropDownClosing" EmptyMessage="select 
            <telerik:RadComboBoxItem Text="1" />
            <telerik:RadComboBoxItem Text="2" />
            <telerik:RadComboBoxItem Text="3" />
            <asp:CheckBox ID="CheckBox1" runat="server" CssClass="check" />
            <asp:Label ID="Label1" runat="server" Text="L1"></asp:Label>

    protected void Page_Load(object sender, EventArgs e)
        foreach (RadComboBoxItem item in RadComboBox1.Items)
            Label l1 = (Label)item.FindControl("Label1");
            l1.Text = item.Text;

    <script type="text/javascript">
        function OnClientDropDownClosing(sender, args) {
            var flag = 0;
            var combo = $find("<%= RadComboBox1.ClientID %>");
            for (var i = 0; i < combo.get_items().get_count(); i++) {
                var checkbox = combo.get_items().getItem(i).get_element().getElementsByTagName("input");
                if (checkbox.item().checked == true) {
                    flag = 1;
            if (flag == 0)
                sender.set_text(" ");
        function OnClientSelectedIndexChanging1(sender, args) {

  3. RK
    RK avatar
    4 posts
    Member since:
    Feb 2014

    Posted 13 Feb 2014 in reply to Shinu Link to this post

    Ok I have added checkbox inside Combo box, so how to get that,

    Code for your reference
     <telerik:RadComboBox ID="rcbLocation" runat="server" AllowCustomText="true" CssClass="Status" AutoPostBack="true" OnSelectedIndexChanged="RadCombo_SelectedIndexChanged">
                                           <asp:CheckBox ID="CheckBox" runat="server" Text='<%# DataBinder.Eval(Container, "Text") %>'
                                                          onclick="onTelerikCheckBoxClick(this,'rcbLocation');" />
  4. Plamen
    Plamen avatar
    3080 posts

    Posted 17 Feb 2014 Link to this post


    I have tested the issue described in our on-line demo and the checkbox was checked when you click on the item element. Here is a video of my test. Please review it and let me know if the scenario you are trying to achieve is somehow different.

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top