RadAutoComplete does not submit when enter is pressed.

4 posts, 0 answers
  1. Peter
    Peter avatar
    2 posts
    Member since:
    Apr 2013

    Posted 22 Apr 2013 Link to this post

    We have the requirement that for a textbox with autocomplete functionality that submits when an asp button is clicked or the user presses enter while the textbox has focus (the use may have entered or selected from the dropdown).

    We also need the AllowCustomEntry functionality that RadAutoCompleteBox supplies.

    I cannot seem to find a solution in the Telerik tools:
    -  RadAutoCompleteBox does not submit on enter. Via JQuery I was able to detect enter and run the click event for my button which submitted to the server ok but the text field for the RadAutoCompleteBox  was blank. When I added a focus event (for the button) before the click event my solution did work in Chrome but not in IE. 

    - RadSearchBox. This control does submit on enter but it does not behave like a true text box. That is it does not display the value entered after the selection is made and does not seem to support an ASP button to kick off the search (this is part of the look and feel of our application). It also submits as soon as you select from the drop down which could be confusing for our users.

    RADAutoCompleteBox is the closest solution but the fact that it does not post back to the server when enter is pressed is a show stopper for us. Apart from running the JQuery focus event prior to the button click event do you know of any other action I might take.

    What I really would like is an autocomplete box that supported a 2 step process: the user selects the entry from the dropdrown which is displayed in the text box and then the user can either press enter or click on the search button to post the text back to the server.

    I hope that this is not too much feedback and my questions are clear. Cheers
  2. Dann Vestergaard
    Dann Vestergaard avatar
    1 posts
    Member since:
    Oct 2009

    Posted 25 Apr 2013 Link to this post

    Hi Peter,

    Any luck on this...?

    I am facing the same issue and would like to fire the default button once enter is hit with focus in my textbox.


  3. DevCraft R3 2016 release webinar banner
  4. Bozhidar
    Bozhidar avatar
    1096 posts

    Posted 25 Apr 2013 Link to this post


    When you postback the page in your handler, the entries are lost because in Text mode RadAutoCompleteBox uses the blur event to save it's entries into the ClientState (and therefore the server). Therefore you have to trigger blur on the input for the entries to be saved. 

    The reason why your logic is not working is related to timing. You have to blur the control and postback after the AutoCompleteBox has had enough time to finish processing the entries. Please try the code patch I've pasted below and see if it works as expected:
    var handler = Telerik.Web.UI.RadAutoCompleteBox.prototype._onKeyDown;
    Telerik.Web.UI.RadAutoCompleteBox.prototype._onKeyDown = function(e) {
        handler.apply(this, [e]); // Let AutoCompleteBox finish it's internal logic
        if (e.keyCode == Sys.UI.Key.enter) {


    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  5. Peter
    Peter avatar
    2 posts
    Member since:
    Apr 2013

    Posted 28 Apr 2013 Link to this post

    Thanks very much for this. It does work and allow the textbox to postback on enter.

    Cheers Peter
Back to Top