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

Closing RadAlert with Enter key: Are you sure you want to leave this page

1 Answer 84 Views
Window
This is a migrated thread and some comments may be shown as answers.
Deepa
Top achievements
Rank 1
Deepa asked on 19 Mar 2013, 05:32 PM
When I am validating a text box, I show a rad alert with error message, if i close the rad alert with mouse, it works perfectly, however
if I hit the 'Enter' key, the first time it behaves as expected, but after that it starts showing up the below message,


Why do i get this message only with 'Enter' key and is there a way to suppress this message?

Thanks,
Deepa

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 20 Mar 2013, 12:15 PM
Hi Deepa,

This is a browser message and is not triggered by the RadAlert, nor can it be controlled by us. The most likely reason for this behaviour is that you have some custom handlers for the enter key that redirect the page. It is possible that they are attached dynamically or they are caused by the presence of a DefaultButton.

What I can suggest you try at this point is making sure that the first button of the popup is focused because some other code on the page could be stealing the focus and thus consuming the enter click:
var oAlert = radalert();
setTimeout(function() {
   oAlert.get_contentElement().getElementsByTagName("A")[0].focus();
}, 0);



Regards,
Marin Bratanov
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
Window
Asked by
Deepa
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or