RadComboBox Enter Key Postback SelectedIndex

2 posts, 0 answers
  1. Mike Lichter
    Mike Lichter avatar
    2 posts
    Member since:
    Apr 2010

    Posted 05 Nov 2010 Link to this post

    Here is what I am trying to do.  I want a searchable combobox.  Enter key does nothing unless the text typed into the search match's something in the list, or something is already selected (highlighted) via the down/up arrows.

    I feel I'm almost there.  I had to check eventArgs._domEvent to get the keyCode.  eventArgs.keyCode is undefined.
    The line: item.select() does not seem to work. var item = sender.findItemByText(sender.get_text()); however is finding the correct item.

    Any help here would be great.  I don't think what I am trying to do is a crazy scenario.  I think this is a common auto complete.

    <script type="text/javascript">
        var ent = false
        function DetectEnter(sender, eventArgs) 
            var keyCode = eventArgs._domEvent.keyCode; 
            if (keyCode == 13) 
                ent = true;
                var item = sender.findItemByText(sender.get_text());
                if (item) {
                    ent = false;
               ent = false
        function CheckEnter(sender, eventArgs) 
            var combo = $find("<%= _SymbolLookup.ClientID %>"); 
            var temp = ent;
            ent = false;

    <telerik:RadComboBox ID="_SymbolLookup" runat="server" AllowCustomText="true" Filter="StartsWith"
        DataTextField="ContactName" EnableLoadOnDemand="True" ShowMoreResultsBox="True"
        EmptyMessage="Type to search for symbol..." OnSelectedIndexChanged="_SymbolLookup_SelectedIndexChanged"
        OnItemsRequested="SymbolLookup_OnItemsRequested" DropDownWidth="525px" Width="200px"
        HighlightTemplatedItems="true" AutoPostBack="true" OnClientKeyPressing="DetectEnter"
            <table width="500px" cellspacing="0" cellpadding="0">
                    <td style="width: 50px;">
                    <td style="width: 375px;">
                    <td style="width: 75px;">
            <table width="500px" cellspacing="0" cellpadding="0">
                    <td style="width: 50px;">
                        <%# DataBinder.Eval(Container, "Attributes['Symbol']")%>
                    <td style="width: 375px; overflow: hidden;">
                        <%# DataBinder.Eval(Container, "Attributes['Instrument_Name']")%>
                    <td style="width: 75px;">
                        <%# DataBinder.Eval(Container, "Attributes['Status']") %>
  2. Simon
    Simon avatar
    2281 posts

    Posted 09 Nov 2010 Link to this post

    Hi Mike Lichter,

    You can get the key code in all browser with the following code:
    var e = eventArgs.get_domEvent();
    var keyCode = e.keyCode || e.which;

    On the other hand, I am not sure the select() method does not work as it is used internally on many occasions in all selection use-cases. Can you explain in greater detail this issue? 

    Kind regards,
    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
Back to Top