I am surprised I cannot find any guidance on how to do a CLIENT-side Yes / No / Cancel dialog box using Telerik Rad controls for ASP.NET AJAX. My best guess is the RadNotification control, but still I cannot find any guidance on how to do this, in either the online documentation or by searching the Forums, Could you please point me to a helpful posting or documentation page on this topic, one that has some sample code?
5 Answers, 1 is accepted
0
Accepted

Princy
Top achievements
Rank 2
answered on 22 Apr 2013, 10:27 AM
Hi,
Please have a look at the following code.
ASPX:
JavaScript:
C#:
Thanks,
Princy.
Please have a look at the following code.
ASPX:
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Delete"
OnClientClicking
=
"showConfirmRadWindow"
OnClick
=
"RadButton1_Click"
>
</
telerik:RadButton
>
<
telerik:RadWindow
ID
=
"confirmWindow"
runat
=
"server"
VisibleTitlebar
=
"true"
VisibleStatusbar
=
"false"
Modal
=
"true"
Behaviors
=
"None"
Height
=
"150px"
Width
=
"300px"
>
<
ContentTemplate
>
<
div
style
=
"padding-left: 30px; padding-top: 20px; width: 200px; float: left;"
>
<
asp:Label
ID
=
"lblConfirm"
Font-Size
=
"14px"
Text
=
"Are you sure you want to Delete?"
runat
=
"server"
></
asp:Label
>
<
br
/>
<
br
/>
<
telerik:RadButton
ID
=
"RadButtonYes"
runat
=
"server"
Text
=
"Yes"
AutoPostBack
=
"false"
OnClientClicked
=
"confirmResult"
>
</
telerik:RadButton
>
<
telerik:RadButton
ID
=
"RadButtonNo"
runat
=
"server"
Text
=
"No"
AutoPostBack
=
"false"
OnClientClicked
=
"confirmResult"
>
</
telerik:RadButton
>
</
div
>
</
ContentTemplate
>
</
telerik:RadWindow
>
JavaScript:
<script type=
"text/javascript"
>
function
showConfirmRadWindow(sender, args) {
$find(
"<%=confirmWindow.ClientID %>"
).show();
$find(
"<%=RadButtonYes.ClientID %>"
).focus();
args.set_cancel(
true
);
}
function
confirmResult(sender, args) {
var
oWnd = $find(
"<%=confirmWindow.ClientID %>"
);
oWnd.close();
if
(sender.get_text() ==
"Yes"
) {
$find(
"<%=RadButton1.ClientID %>"
).click();
}
}
</script>
C#:
protected
void
RadButton1_Click(
object
sender, EventArgs e)
{
Label l1 =
new
Label();
this
.form1.Controls.Add(l1);
l1.Text =
"File Deleted"
;
}
Thanks,
Princy.
0
Hi guys,
I would advise that you examine a simpler alternative - the predefined dialogs from the RadWindowManager control: http://demos.telerik.com/aspnet-ajax/window/examples/browserdialogboxes/defaultcs.aspx. The demo shows them in action and more detailed information is available in the documentation: http://www.telerik.com/help/aspnet-ajax/window-dialogs-confirm.html.
Greetings,
Marin Bratanov
the Telerik team
I would advise that you examine a simpler alternative - the predefined dialogs from the RadWindowManager control: http://demos.telerik.com/aspnet-ajax/window/examples/browserdialogboxes/defaultcs.aspx. The demo shows them in action and more detailed information is available in the documentation: http://www.telerik.com/help/aspnet-ajax/window-dialogs-confirm.html.
Greetings,
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.
0

Scott
Top achievements
Rank 1
answered on 23 Apr 2013, 01:39 AM
Thanks, Princy. I had to add the third button I wanted (Cancel) and replace the "args.set_cancel(true)" with "return false", but then it worked.
0

Scott
Top achievements
Rank 1
answered on 23 Apr 2013, 01:41 AM
Marin, I agree the pre-defined Confirm is easier, but since I was looking for a 3-button dialog (Yes / No / Cancel), I went with the RadWindow approach.
0
Hello,
I am glad you have the desired effect working, I just wanted to note that you can add another button by modifying the confirm template as shown here: http://www.telerik.com/help/aspnet-ajax/window-dialogs-changing-dialog-templates.html.
Greetings,
Marin Bratanov
the Telerik team
I am glad you have the desired effect working, I just wanted to note that you can add another button by modifying the confirm template as shown here: http://www.telerik.com/help/aspnet-ajax/window-dialogs-changing-dialog-templates.html.
Greetings,
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.