6 Answers, 1 is accepted
By design RadWindowManager will always focus the first button in the confirmation dialog. If you want to customize this behavior, you need to implement a custom confirm template. More information on RadWindowManager's templates is available here.
Sincerely yours,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Georgi,
Can you be more specific as to what needs to be done in the template to change the focus to the cancel button. Also, once this is done, will pressing the spacebar fire the cancel button event?
Lee
Hi Lee,
The easiest approach is to use JavaScript to focus the desired button after opening the dialog. Here is an example
var
dialog = radconfirm(
"sure?"
, callback);
setTimeout(
function
() {
//first option is for Classic RenderMode, second is for Lightweight RenderMode
var
cancelBtn = $telerik.$(
".rwPopupButton"
, dialog.get_contentElement()).get(1) || $telerik.$(
".rwCancelBtn"
, dialog.get_contentElement()).get(0);
if
(cancelBtn) {
cancelBtn.focus();
}
}, 0);
Regards, Marin Bratanov
Telerik by Progress
Unfortunately, I am calling radconfirm from vb.net server side. How do I set default in that case? Here is what I'm doing:
RadWindowManager1.RadConfirm(....)
Hi,
You can use the OnClientShow event of the RadWindowManager to execute this code. Just replace the dialog variable with the sender argument: http://docs.telerik.com/devtools/aspnet-ajax/controls/window/client-side-programming/events/onclientshow.
Here is an example:
<telerik:RadWindowManager ID=
"RadWindowManager1"
runat=
"server"
OnClientShow=
"OnClientShowHandler"
RenderMode=
"Lightweight"
></telerik:RadWindowManager>
<script>
function
OnClientShowHandler(sender, args) {
setTimeout(
function
() {
//first option is for Classic RenderMode, second is for Lightweight RenderMode
var
cancelBtn = $telerik.$(
".rwPopupButton"
, sender.get_contentElement()).get(1) || $telerik.$(
".rwCancelBtn"
, sender.get_contentElement()).get(0);
if
(cancelBtn) {
cancelBtn.focus();
}
}, 0);
}
function
callback(arg) {
alert(arg);
}
</script>
protected
void
Page_Load(
object
sender, EventArgs e)
{
RadWindowManager1.RadConfirm(
"sure?"
,
"callback"
,
null
,
null
,
null
,
"title"
);
}
Regards, Marin Bratanov
Telerik by Progress