Click here to Skip to main content
15,886,693 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in the namespace not have messagebox.show
Posted

Nup, using messagebox.show in Asp.net is a bad idea. you can use javascript to do the same.
http://www.w3schools.com/js/js_popup.asp[^]
http://dhtmlx.com/docs/products/dhtmlxMessage/index.shtml[^]

If you want to show messagebox from code behind then you can use ScriptManager Class[^] to register javascript with page. Try this
C#
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Myscript1", @"alert('Hi am a alert box');", true);



--Amit
 
Share this answer
 
Problem

Message Box is for Windows Forms. You can still use it, but that will not reflect at client side.

Solution

So, you need to use javaScript alert or confirm box.
 
Share this answer
 
Simplest way:

C#
Response.Write("<script type='text/javascript'>");
Response.Write("alert('There does not exist any simpler alert then this.');");
Response.Write("</script>");


Regards.. :laugh:
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900