MarkFirstMatch

2 posts, 0 answers
  1. David
    David  avatar
    35 posts
    Member since:
    Dec 2008

    Posted 25 Oct 2010 Link to this post

    Here my combo box:

    <

     

     

    telerik:RadComboBox ID="rcbItemName" runat="server" AllowCustomText="True" CausesValidation="False" MarkFirstMatch="True" />

     



    I am allowing the customer type in the itemname.  If the itemname exist it mark the first match.     That works good. 
    I also what the customer to be able to enter a itemname that is not in the dropdown list.  That works good.

    Is there a way for the dropdown box to close once the itemname does not match anything in the drop down list?  I look at the demo and it does not close when an item is not match.

    Thanks,
    David
  2. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 01 Nov 2010 Link to this post

    Hello David ,

    I am afraid that the behaviour that you describe is not officially supported.

    You can try attaching an onkeyup event handler to RadComboBox input at client-side page load.
    Then after user types a text at control input simply check if there is a RadComboBox item with such text and  close the dropdown.
    <script type="text/javascript">
     
        function pageLoad() {
            var combo = $find("<%=rcbItemName.ClientID %>");
            var input = combo.get_inputDomElement();
            input.onkeyup = onKeyUpHandler;
        }
     
     
        function onKeyUpHandler(e) {
     
            var combo = $find("<%=rcbItemName.ClientID %>");
            var comboText = combo.get_text();
            var item = combo.findItemByText(comboText);
            if (item == null && comboText != "") {
     
                combo.hideDropDown();
            }
            else if (e.keyCode == 8) {
                if (!combo.get_dropDownVisible())
                    combo.showDropDown();
            }
        }
    </script>
     
    <telerik:RadComboBox ID="rcbItemName" runat="server"
        AllowCustomText="True" CausesValidation="False"
        MarkFirstMatch="True" />

    I hope this helps.

    All the best,
    Kalina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top