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

select items only in the list

1 Answer 67 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Sathish
Top achievements
Rank 1
Sathish asked on 29 Oct 2010, 07:28 PM
Hi,

When using LoadOnDemand, if the text I type does not exist in the datasource, i do not want the item to be selected. So when you lose focus from combobox, it the text I typed is an invalid selection, it should either be cleared or the first match should be selected. If no first match found for what is entered, it should be blank..

Basically i don't want any values/text that is not in the list.

Btw, i found that in obout suite, does telerik support this?

Thanks.

sathish

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Nov 2010, 10:53 AM
Hello Sathish,


You can easily interact with the combobox in the browser using the combobox client-side object since it provides a flexible client-side API. In this scenario, simply attach OnClientBlur event to RadComboBox and try the following code to get the desired behaviour.

Client code:
<script type="text/javascript">
    function OnClientBlur(sender, args) {
        if (sender.findItemByText(sender.get_text()) == null) {
            sender.clearSelection();
        }
    }
</script>


Happy coding...
Shinu.
Tags
ComboBox
Asked by
Sathish
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or