This is a migrated thread and some comments may be shown as answers.

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

3 Answers 119 Views
Input
This is a migrated thread and some comments may be shown as answers.
Thad
Top achievements
Rank 2
Thad asked on 12 Feb 2011, 10:12 PM
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.

Thanks!
Thad

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 17 Feb 2011, 10:53 AM
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

0
Bala
Top achievements
Rank 1
answered on 22 Aug 2012, 09:45 AM

 

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

0
Vasil
Telerik team
answered on 27 Aug 2012, 12:03 PM
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.

Greetings,
Vasil
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.
Tags
Input
Asked by
Thad
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Bala
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or