RadMaskedTextBox is possessive and keeping focus when Enter key pressed to fire default button

4 posts, 0 answers
  1. Thad
    Thad avatar
    106 posts
    Member since:
    Sep 2010

    Posted 12 Feb 2011 Link to this post

    Hey Telerik and other gurus!

    Odd scenario when using RadInput controls...

    Please see the attached image - BeforePressingEnter.png --- The Add button is the default button (ImageButton).  The green area is a DIV.  When the Add button is clicked, it uses jQuery to collapse the green div and set focus to the next control on the form using RadAjaxManager.GetCurrent(control.Page).FocusControl(control);.

    When focus is ON the phone number masked edit box and the user presses enter, sometimes (but not always), the RadMaskedTextBox gets a little clingy and doesn't want to give up it's focus.  What the user sees is what you see in AfterPressingEnter.png.  Notice the cursor is where the masked text box is before the green area is collapsed.

    When focus is on any other control pictured or if you manually click on the Add button focus moves as is appropriate.

    This same situation has been observed when we have a RadGrid using InPlace editing and one of the controls in the EditTemplate is a RadInput control.  I've seen other similar posts in the RadGrid forums regarding how to use the enter key to cause the grid to save the changes, but there was no solution offered up there.

    Got any ideas Telerik?

    A "work-around" we have implemented is to capture the enter key on the client side keydown event of the RadNumericTextBox and set focus to the Add button.

    This appears to only occur in IE.  Firefox 3.6.3 and Chrome 8.0.552 both seem to be immune to this situation.

  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 17 Feb 2011 Link to this post

    Hi Thad,

    Thank you for contacting us.

    Could you please let me know if this behavior occurs with the latest version of RadControls. Also could you please test the application by disabling the Ajax on the page and set the focus after postback, so we could isolate if the issue is Ajax related.

    Kind regards,
    Maria Ilieva
    the Telerik team

  3. Bala
    Bala avatar
    11 posts
    Member since:
    Aug 2012

    Posted 22 Aug 2012 Link to this post


    I have a login page which contains username (radtextbox control),password field (radtextbox control) and a Authenticate button (asp button control).
    i have written code in .cs to make Authenticate button as default button. so once i enter username and password and hit enter key Authenticate button (default button) is firing.
    but after installed the licensed version of telrik (2012.2.724.40) asp.net controls default button is not working

  4. Vasil
    Vasil avatar
    1642 posts

    Posted 27 Aug 2012 Link to this post

    Hi Thad,

    The Image button does not get the focus, so the RadMaskedTextBox remains as active element. You can actually add additional script logic inside the jQuery code that you use for handling the Add button client side click, and to focus some control or to blur the masked text box.

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