How to display alert message from code behind file in asp.net ?


Hi

There are so many approaches to display alert message from code behind file i.e by vb.net and C#. But one of the easiest ways to display alert message using Ajax ScriptManager like this

Write code on buttonclick event like this


 protected void Button1_Click(object sender, EventArgs e)
    {
        // Here will be your some conditional code
        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Data has been added Sucessfully');", true);
    }
Advertisement

One thought on “How to display alert message from code behind file in asp.net ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.