New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Confirm Dialog

window.confirm() RadConfirm


Confirmation Result:

This functionality is used to show confirmation pop-up/dialog asking for confirmation from the user for the next actions, whether a client-script is to be executed or a Post back to be done.

As of R2 2019, all button types except the RadRadioButtonList and RadCheckboxList come with built-in Confirmation Dialog and you can enable it simply by defining a text for the ConfirmText property.

Properties

  • ConfirmText: Enables the Confirm Dialog functionality and sets the confirmation message
  • UseRadConfirm: Switches between RadConfirm and window.confirm() dialog mode.
    • Default value: true
    • UseRadConfirm="True" requires a RadWindowManager on the page
  • Title: Sets the title of the dialog window (applicable for RadConfirm only)
  • Height: Sets the dialog height (applicable for RadConfirm only)
  • Width: Sets the dialog width (applicable for RadConfirm only)
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
  • styles.css
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.ConfirmDialog.DefaultCS"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <script src="scripts.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Panel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Silk" MinDisplayTime="300"></telerik:RadAjaxLoadingPanel>
    <asp:Panel ID="Panel1" runat="server" CssClass="demo-container size-narrow">
        <table>
            <thead>
                <tr>
                    <th>window.confirm()</th>
                    <th>RadConfirm</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <telerik:RadButton ID="RadButton1" runat="server" Text="RadButton1" OnClientClicked="OnClientClicked" OnClick="Button_Click">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" UseRadConfirm="false" />
                        </telerik:RadButton>
                    </td>
                    <td>
                        <telerik:RadButton ID="RadButton2" runat="server" Text="RadButton2" OnClientClicked="OnClientClicked" OnClick="Button_Click">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" Height="200" Title="Button Confirm Dialog" Width="300" />
                        </telerik:RadButton>
                    </td>
                </tr>
                <tr>
                    <td>
                        <telerik:RadCheckBox ID="RadCheckBox1" runat="server" Text="RadCheckBox1" OnClientClicked="OnClientClicked" OnClick="Button_Click">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" UseRadConfirm="false" />
                        </telerik:RadCheckBox>
                    </td>
                    <td>
                        <telerik:RadCheckBox ID="RadCheckBox2" runat="server" Text="RadCheckBox2" OnClientClicked="OnClientClicked" OnClick="Button_Click">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" Height="200" Title="Button Confirm Dialog" Width="300" />
                        </telerik:RadCheckBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <telerik:RadLabel ID="RadLabel2" runat="server" AssociatedControlID="RadSwitch1" Text="RadSwitch1"></telerik:RadLabel>
                        <telerik:RadSwitch ID="RadSwitch1" runat="server" Text="RadSwitch1" OnClientClicked="OnClientClicked" OnClick="Button_Click" Width="50px">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" UseRadConfirm="false" />
                        </telerik:RadSwitch>
                    </td>
                    <td>
                        <telerik:RadLabel ID="RadLabel3" runat="server" AssociatedControlID="RadSwitch2" Text="RadSwitch2"></telerik:RadLabel>
                        <telerik:RadSwitch ID="RadSwitch2" runat="server" Text="RadSwitch2" OnClientClicked="OnClientClicked" OnClick="Button_Click" Width="50px">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" Height="200" Title="Button Confirm Dialog" Width="300" />
                        </telerik:RadSwitch>
                    </td>
                </tr>
                <tr>
                    <td>
                        <telerik:RadPushButton ID="RadPushButton1" runat="server" Text="RadPushButton1" OnClientClicked="OnClientClicked" OnClick="Button_Click">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" UseRadConfirm="false" />
                        </telerik:RadPushButton>
                    </td>
                    <td>
                        <telerik:RadPushButton ID="RadPushButton2" runat="server" Text="RadPushButton2" OnClientClicked="OnClientClicked" OnClick="Button_Click">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" Height="200" Title="Button Confirm Dialog" Width="300" />
                        </telerik:RadPushButton>
                    </td>
                </tr>
                <tr>
                    <td>
                        <telerik:RadLinkButton ID="RadLinkButton1" runat="server" Text="RadLinkButton1" NavigateUrl="https://demos.telerik.com/aspnet-ajax/button" Target="_blank">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" UseRadConfirm="false" />
                        </telerik:RadLinkButton>
                    </td>
                    <td>
                        <telerik:RadLinkButton ID="RadLinkButton2" runat="server" Text="RadLinkButton2" NavigateUrl="https://demos.telerik.com/aspnet-ajax/button" Target="_blank">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" Height="200" Title="Button Confirm Dialog" Width="300" />
                        </telerik:RadLinkButton>
                    </td>
                </tr>
                <tr>
                    <td>
                        <telerik:RadToggleButton runat="server" ID="RadToggleButton1" OnClientClicked="OnClientClicked">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" UseRadConfirm="false" />
                            <ToggleStates>
                                <telerik:ButtonToggleState Text="RadToggleButton1 - First Toggle"></telerik:ButtonToggleState>
                                <telerik:ButtonToggleState Text="RadToggleButton1 - Second Toggle"></telerik:ButtonToggleState>
                            </ToggleStates>
                        </telerik:RadToggleButton>
                    </td>
                    <td>
                        <telerik:RadToggleButton runat="server" ID="RadToggleButton2" OnClientClicked="OnClientClicked">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" Height="200" Title="Button Confirm Dialog" Width="300" />
                            <ToggleStates>
                                <telerik:ButtonToggleState Text="RadToggleButton2 - First Toggle"></telerik:ButtonToggleState>
                                <telerik:ButtonToggleState Text="RadToggleButton2 - Second Toggle"></telerik:ButtonToggleState>
                            </ToggleStates>
                        </telerik:RadToggleButton>
                    </td>
                </tr>
                <tr>
                    <td>
                        <telerik:RadImageButton ID="RadImageButton1" runat="server" Text="RadImageButton1" Width="230px" Height="230px" OnClientClicked="OnClientClicked" OnClick="Button_Click">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" UseRadConfirm="false" />
                            <Image Url="https://demos.telerik.com/aspnet-ajax/editor/images/top_image.png" />
                        </telerik:RadImageButton>
                    </td>
                    <td>
                        <telerik:RadImageButton ID="RadImageButton2" runat="server" Text="RadImageButton2" Width="230px" Height="230px" OnClientClicked="OnClientClicked" OnClick="Button_Click">
                            <ConfirmSettings ConfirmText="Are you sure you want to continue?" Height="200" Title="Button Confirm Dialog" Width="300" />
                            <Image Url="https://demos.telerik.com/aspnet-ajax/editor/images/top_image.png" />
                        </telerik:RadImageButton>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="2">
                        <telerik:RadCheckBox ID="RadCheckBoxPostBack" runat="server" Text="Disable AutoPostBack"></telerik:RadCheckBox>
                    </td>
                </tr>
            </tfoot>
        </table>
        <br />
        <br />
        <p>Confirmation Result:</p>
        <telerik:RadLabel ID="RadLabel1" runat="server"></telerik:RadLabel>
    </asp:Panel>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance