Baxter Baxter - 1 year ago 168
ASP.NET (C#) Question

ASP.NET Web Application Message Box

In an windows forms application, in the C# code behind you can use:

MessageBox.Show("Here is my message");

Is there any equivalent in a web application?
Can I call something from the C# code behind that will display a message box to the user?

Example usage of this: I have a button that loads a file in the code behind. When the file is loaded or if there is an error I would like to popup a message to the user stating the result.

Any ideas on this?

Answer Source

You want to use an Alert. Unfortunately it's not as nice as with windows forms.

ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable + "');", true);

Similar to this question here:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download