This is the simple demonstration in JavaScript how to use confirmation box. Confirmation box are used for check the user confirmation for example you want to delete this item, you want to continue this page etc.

So, this is the simple code how to use confirmation box.

Write this code on aspx page
<head runat="server">
    <title>Sample for Confirmation Box</title>
    <script type="text/javascript">
        function FuncCheck() {
            var strVal = confirm("Are you sure you want to show this content?");
            if (strVal == true) {
                return true;
            else {
                var lblMsg = document.getElementById('lblMsg');
                lblMsg.innerHTML = "";
                return false;
    <form id="form1" runat="server">
        <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick="return FuncCheck()"
            OnClick="btnSubmit_Click" />
        <asp:Label ID="lblMsg" runat="server"></asp:Label>

 And write this code at code behind page

protected void btnSubmit_Click(object sender, EventArgs e)
        lblMsg.Text = "This is your content.....";
  Modified On Nov-29-2017 07:42:25 PM

Leave Comment