Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Long time Winforms programmer trying to grow webs....after about 30 minutes into my first real asp.net website project I need a MessageBox function..... Everything I find involves jumping through hoops of fire and javascript functions to get back as simple value from the user. Seriously? Is there not a simple server-side control that mimics the function of a Winforms control where you just call it and it returns the value the user selected?
Posted

Web application is all about HTML and JavaScript. Here there is no messagebox equivalent server side control. However you can register a JavaScript "alert()" function from server side which virtually acts as messagebox. :) here is code...
C#
//
Page.RegisterClientScriptBlock("MyScript", "<script>alert('Data saved successfully')</script>");
// OR
ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "<script>alert('Data saved successfully')</script>", false);
 
Share this answer
 
v2
I remember going from Windows to Web years ago and finding them to be very, very different. The web is much more difficult.

And no, no simple messagebox. Has to be done from client side. Get to know jQuery, it will help you a lot. In fact there are many nice jQuery plugins for showing dialog messages.
 
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