Click here to Skip to main content
15,896,456 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I would like to know how to display a Messagebox in asp.net web application incase of errors or for conformation to end users. In C# Windows application this facilite is available with MessageBox.Show("message to display") like this is there any functions are availble in asp.net web application to display message?

Please anybody give me information to achive this.

Thanks in advance
Uday
Posted

use javascript or jquery with alert....
you can not find messagebox in web.
 
Share this answer
 
Please check below

C#
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('Hi.....);</script>");


if you used any update panels then check below

C#
ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(string), "alertscipt", "alert('Hi....')", true);
 
Share this answer
 
v2
There is no message box available in asp.net like c#.

you can use javascript alert box. Like...
ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "alert('" + error + "');", true);


Refer this link

http://www.karpach.com/Javascript-Alert-Message-codebehind-ASP-NET.htm[^
 
Share this answer
 
v2
Comments
vvvjghjg 25-Aug-12 6:56am    
do we need to write both the function and this above showed script line???
Hi,

Javascript is good option. Other way is to use AJAX.

I have used Majic Ajax some years back and they provide good option to set messagebox from server side C# code. You can also use other Ajax libraries available in open source market.

Thanks
Subhendu
 
Share this answer
 

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