When you’re building ASP.NET WebForms applications, showing feedback messages to users is crucial. You may use:

Let’s break this down step by step.

1. ScriptManager.RegisterStartupScript – The Bridge

if (SqlHelper.ExecuteNonQuery(sqlcon, CommandType.Text, sqlBidD, param3) > 0)
{
    ScriptManager.RegisterStartupScript(this, this.GetType(), "success", "order();", true);
}
else
{
   
    string script = "alertify.alert('" + password Expired + "');";
    ScriptManager.RegisterStartupScript(this, this.GetType(), "alertifyScript", script, true);
}

Explanation

Without ScriptManagerYour JavaScript may not run after a postback in an UpdatePanel.

2. order() function with Alertify

function order() {
    alertify.alert(
        "Application placed successfully.  Please approve it to confirm your application.",
        function (e) {
            if (e) {
                window.history.pushState(null, "", window.location.href);
                window.location = '/orders.aspx';
            } else {
                window.location = '/ClientPages.aspx';
            }
        }
    );
}

🔍 Key points

alertify looks modern and customizable compared to plain alert.

3. Example. Normal JavaScript Alert via ScriptManager

if (SqlHelper.ExecuteNonQuery(SqlCon, CommandType.Text, sqlins) > 0)
{
    ScriptManager.RegisterStartupScript(this, this.GetType(), "success", "alert('Client details added in Master.');", true);
}

4. Redirect with Alert

ScriptManager.RegisterStartupScript(
    this.Page, 
    this.Page.GetType(), 
    "Msge", 
    "alert('Client Details updated successfully');window.location='/Admin/ClientPages.aspx';", 
    true
);

Here

5. Error Handling with Alert

ScriptManager.RegisterStartupScript(
    this.Page, 
    typeof(string), 
    "alert", 
    "alert('" + ex.Message.ToString() + "');", 
    true
);

6. Custom JS Function via ScriptManager

function HideTable() {
    if (detectmob()) {
        document.getElementById("ipotable").style.display="none";
        document.getElementById("tblNodata").style.display="none";
    }
}
ScriptManager.RegisterStartupScript(this.Page, typeof(string), "hide", "HideTable();", true);

7. Thank You Message + Redirect

ScriptManager.RegisterStartupScript(
    this, 
    typeof(string), 
    "Message", 
    "alert('Thank you for providing details. Our Representative will contact you soon.');window.location='/'", 
    true
);

Shows message and redirects to homepage /.

8. Plain JavaScript Alert (Client-side)

function Validatecatelog() {
    if ($(".totalclass").text() == "0") {
        alert("Please select API");
        return false;
    }
}
<asp:Button ID="btn_showprice" runat="server" Text="Next" CssClass="price_btn" OnClientClick="return Validatecatelog();"  />
if (dstotal.Tables[0].Rows.Count > 0)
            {
                totaldata = "<span class='totalclass'>" + dstotal.Tables[0].Rows[0]["total"].ToString() + "</span>";
            }

9. Confirmation Box

let text = "It seems your account is not associated with the provided UPI ID.\n Are you sure you want to proceed?";
if (confirm(text)) {
    document.getElementById("clupiname").innerText = cname1;
    offline_2lcondition();
    return true;
} else {
    return false;
}

Difference: Alert vs Alertify vs Confirm

Featurealert()alertify.alert()confirm()
TypeBuilt-in JSExternal JS LibraryBuilt-in JS
UIOld, blockingModern, customizableOld, blocking
Customization❌ No✅ Yes (themes, buttons)❌ No
Callback❌ No✅ Yes (with function)✅ Returns boolean
Redirect SupportOnly with extra JSEasy (inside callback)Easy (via true/false)
Use CaseQuick infoUser-friendly notificationsUser decisions (Yes/No)

Conclusion