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

2 posts, 0 answers
  1. Deepa
    Deepa avatar
    3 posts
    Member since:
    Apr 2011

    Posted 19 Mar 2013 Link to this post

    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?


  2. Marin Bratanov
    Marin Bratanov avatar
    3567 posts

    Posted 20 Mar 2013 Link to this post

    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() {
    }, 0);

    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top