Setting keyboard focus for RadWindowManager -Alert,Confirm,Prompt

5 posts, 0 answers
  1. Siva
    Siva avatar
    5 posts
    Member since:
    Aug 2013

    Posted 27 Aug 2013 Link to this post

    I am using the predefined dialogs (radalert, radconfirm and radprompt) from the server methods RadAlert, RadConfirm and RadPrompt of the RadWindowManager.It is possible to set the behavior that pressing Escape will trigger the Cancel button and Pressing Enter will trigger the OK button even if the focus is out of the predefined dialogs.
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5314 posts

    Posted 28 Aug 2013 Link to this post

    Hello Siva,

    Triggering Cancel can be configured by a Shortcut for the manager that will close the popup:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Shortcuts>
            <telerik:WindowShortcut CommandName="Close" Shortcut="Esc" />
        </Shortcuts>
    </telerik:RadWindowManager>

    Note that this will affect all RadWindows opened from this manager. Also, the callback function will not receive arguments in this case, while it usually will (false for RadConfirm and null for RadPrompt).


    The other, more complex option is to create your own keypress or keydown handlers for the body element that will do the necessary work. This can also be used for triggering the OK button. Details on the case and a sample script are available in this thread. You can use the code as base and extend it further to match your needs.

    Regards,
    Marin Bratanov
    Telerik
    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 the blog feed now.
  3. Siva
    Siva avatar
    5 posts
    Member since:
    Aug 2013

    Posted 30 Aug 2013 Link to this post

    Hi Marin Bratanov
    Thanks for the solution.
    But I am using the server side RadAlert, RadConfirm and RadPrompt.But the solution contains the code for client side modal dialogs.How can we close the Radalert called from server side in javascript when the Keyboard event is triggered.

     

     

     

  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5314 posts

    Posted 30 Aug 2013 Link to this post

    Hi Siva,

    It does not matter whether the dialogs are opened with server code or not, in any case they "live" in the browser, so client-side code is what can manipulate them while they are shown.

    You can register a script from the server to show the dialogs if you decide to use additional code. How to do this is explained here: http://www.telerik.com/help/aspnet-ajax/radwindow-troubleshooting-javascript-from-server-side.html.


    Regards,
    Marin Bratanov
    Telerik
    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 the blog feed now.
  5. Siva
    Siva avatar
    5 posts
    Member since:
    Aug 2013

    Posted 30 Aug 2013 Link to this post

    Hi Marin Bratanov
     The sample solution provided uses the client side events, oDialog = radalert("sure?", callbackFn); and we are closing the prompt during key press by using oDialog.close(true);
    Since i am using the RadWindowManager1.RadAlert in the server side,how we can find the dialog window in javascript and trigger the close during key press.

     

     

     

     

     

     

     

     

Back to Top