select items only in the list

2 posts, 0 answers
  1. Sathish
    Sathish avatar
    25 posts
    Member since:
    Dec 2008

    Posted 29 Oct 2010 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Nov 2010 Link to this post

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