Telerik RadWindow is mostly used as an ajax popup window to load a separate page. But it can be used a neat alert/confirm box instead of using the JavaScript confirm box. Here is the code below -
Aspx
<asp:Button ID="btnOpenPopup" runat="server" Text="Close" OnClick="btnOpenPopup_Click" />
<br />
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<telerik:RadWindow ID="radwindowPopup" runat="server" VisibleOnPageLoad="false" Height="150px"
Width="300px" Modal="true" BackColor="#DADADA" VisibleStatusbar="false" Behaviors="None" Title="Unsaved changes pending">
<ContentTemplate>
<div style="padding: 20px">
Do you want to save the changes?
<br /><br />
<asp:Button ID="btnOk" runat="server" Text="Yes" Width="50px" OnClick="btnOk_Click" />
<asp:Button ID="btnCancel" runat="server" Text="No" Width="50px" OnClick="btnCancel_Click" />
</div>
</ContentTemplate>
</telerik:RadWindow>
Aspx.cs
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnOpenPopup_Click(object sender, EventArgs e)
{
radwindowPopup.VisibleOnPageLoad = true;
}
protected void btnOk_Click(object sender, EventArgs e)
{
radwindowPopup.VisibleOnPageLoad = false;
lblMessage.Text = "Changes are saved!";
}
protected void btnCancel_Click(object sender, EventArgs e)
{
radwindowPopup.VisibleOnPageLoad = false;
lblMessage.Text = "Changes are discarded!";
}
}
Button ‘btnOpenPopup’ opens the popup by making the radwindow visible by setting ‘VisibleOnPageLoad’ to true. To hide it you just need to set it back to false. You’ve got your custom confirm box now which looks sleek.




#1 by ju on November 3, 2011 - 1:52 pm
Thanks! I’m looking for this!!!
#2 by nlvraghavendra on November 3, 2011 - 5:43 pm
Glad it helped.