c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
c# .net

How to show Message box using asp.net web application?

| | ASP , ASP-NET

Inan asp.net windows forms application we are using in code behind as MessageBox.Show("I am message box"); 

Wecan also make equivalent to that using asp.net web application.

     <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />

     protected void Button1_Click(object sender, EventArgs e)

    {

             string input = "I am message box";

   ClientScript.RegisterStartupScript(this.GetType(), "messagebox", "alert('Message:" + input + "');", true);

     }

 

Output: