Yes/No Confirm Box

Copy and paste the ncToolControls.dll to your project bin folder or reference ncToolControls.dll to your project.
ncToolControls .NET Assembly donwload here --> ncToolControls.zip

You need the AjaxControlToolkit nuget, please download here --> AjaxToolKit Nuget
AjaxToolKit Samples --> Ajaxtoolkit Samples

Sample Yes/No Confirm Box using the AjaxToolKit and the ncToolControls with embedded .CSS and Javascript file.
You need both(AjaxToolKit.dll and ncToolControls.dll) .NET assemblies for this sample to work.

ConfirmYN.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ConfirmYN.aspx.cs" Inherits="CS" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolKit" %>    
<%@ Register Assembly="ncToolControls" Namespace="ncToolControls" TagPrefix="nc" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Ajax Confirm Yes/No Box</title>
    <style type="text/css">
        body {font-family: Verdana, Arial, 'Microsoft Sans Serif'; font-size: 10pt;}
    </style>
   
</head>
<body>
    <h2>Sample Ajax Confirm Yes/No Box</h2> 
    <p>You need the AjaxControlToolkit for the extender download the nuget here --> <a href="https://www.nuget.org/packages/AjaxControlToolkit/" target="_blank">Get the AjaxToolKit Nuget</a></p>
    <p><a href="https://www.ajaxtoolkit.net">AjaxToolKit Samples</a></p>
    <p>Download the ncToolControls .NET assembly here --><a href="https://netstaircom.net" target="_blank">ncToolControls Dynamic Link Library.</a></p>
    <form id="form1" runat="server">
         <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
         <asp:Button ID="bntDeleteRow" Text="Delete" OnClick="btnExecute_Click" runat="server" />
         <ajaxToolKit:ConfirmButtonExtender ID="cbe" runat="server" DisplayModalPopupID="mpe" TargetControlID="bntDeleteRow"></ajaxToolKit:ConfirmButtonExtender>
         <ajaxToolKit:ModalPopupExtender ID="mpe" runat="server" PopupControlID="pnlPopup" TargetControlID="bntDeleteRow" OkControlID="btnYes" CancelControlID="btnNo" BackgroundCssClass="modalBackground"></ajaxToolKit:ModalPopupExtender>  
         <nc:AjaxConfirmBox ID="acb" HeaderContent="Confirmation deletion" BodyContent="Do you want to delete this record?" runat="server" />
         <p style="text-align: center;"><asp:Label ID="lblMessage" ForeColor="Red" runat="server"></asp:Label></p>  
    </form>
</body>
</html>

ConfirmYN.aspx.cs (Code behind)
using System;

public partial class CS : System.Web.UI.Page
{
    protected void Page_Init(object sender, EventArgs e)
    {
        this.acb.btnYesConfirm.Click += new EventHandler(btnExecute_Click);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

        }
    }

    protected void btnExecute_Click(object sender, EventArgs e)
    {
        string message = "Deleting Record.";
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.Append("<script type = 'text/javascript'>");
        sb.Append("window.onload=function(){");
        sb.Append("alert('");
        sb.Append(message);
        sb.Append("')};");
        sb.Append("</script>");
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
        this.lblMessage.Text = "Successfully Deleted.";
    }
}
Output after clicking on the [Delete] button

Download the whole project here --> AjaxConfirmBoxSample.zip

Happy Coding!

Enjoy it.

Add Feedback