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

Setting keyboard focus for RadWindowManager -Alert,Confirm,Prompt

4 Answers 23 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Siva
Top achievements
Rank 1
Siva asked on 27 Aug 2013, 10:57 AM
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.

4 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 28 Aug 2013, 12:02 PM
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.
0
Siva
Top achievements
Rank 1
answered on 30 Aug 2013, 07:50 AM
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.

 

 

 

0
Marin Bratanov
Telerik team
answered on 30 Aug 2013, 01:48 PM
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.
0
Siva
Top achievements
Rank 1
answered on 30 Aug 2013, 02:08 PM
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.

 

 

 

 

 

 

 

 

Tags
General Discussions
Asked by
Siva
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Siva
Top achievements
Rank 1
Share this question
or