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

combobox value deleted with backspace but items are still selected

1 Answer 43 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Karel
Top achievements
Rank 1
Karel asked on 21 Jan 2014, 10:38 AM
Hi,

I have RadCombobox with checkboxes. User checks some values then click outside the combobox, then she deletes the combobox value with backspace and click outside again. Now combobox shows empty message but originaly checked items are still checked.

Do I have to uncheck them on client side?

Thank you.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Jan 2014, 11:23 AM
Hi Karel,

Please have a look into the following code snippet to achieve your scenario.

ASPX:
<telerik:RadComboBox ID="RadComboBox1" runat="server" CheckBoxes="true" EmptyMessage="select"
    AllowCustomText="true" onkeydown="uncheck(event);">
    <Items>
        <telerik:RadComboBoxItem Text="Item1" />
        <telerik:RadComboBoxItem Text="Item2" />
        <telerik:RadComboBoxItem Text="Item3" />
    </Items>
</telerik:RadComboBox>

JavaScript:
<script type="text/javascript">
    function uncheck(event) {
        if (event.keyCode == 8) {
            var combo = $find("<%=RadComboBox1.ClientID %>");
            var item = combo.get_text();
            combo.findItemByText(item).uncheck();
        }
    }
</script>

Thanks,
Shinu.
Tags
ComboBox
Asked by
Karel
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or