Click here to Skip to main content
15,893,190 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a problem regarding webforms in asp.net. I'm unable to show error message in message box where it is possible with wpf, Alert is possible but they are asking for Messagebox .If i do same thing like wpf ...error message is showing in task bar. Can any one help me for this

What I have tried:

I Tried With Repose.WRIte("hello"0;
Posted
Updated 7-Jan-20 10:26am

MessageBox in ASP.NET does not exist. You have to use JavaScript to render a popup in the browser or use client-side library like jQuery, bootstrap etc... Fortunately, WebForms offers AjaxControlToolkit controls which is a wrapper for standard ASP.NET Server Controls. The AjaxControlToolkit control has a ModalPopupExtender [^]that you can use to display a modal without writing JavaScript yourself.

If you want a pre-built MessageBox like controls in ASP.NET, then you might want to try out my opensource control that I've built many years ago here: A Customized MessageBox, ConfirmBox and FrameBox Controls For ASP.NET WebForms[^]
 
Share this answer
 
v2
You can't show MessageBoxes in web apps: C# code always runs on the server, never the client - which means that the user can't see your message box (and you app can;t continue until somebody closes the message b0ox on the server.
Alert is how you talk to the user: MessageBox may appear to work in development, but that is only because the Client and the Server are the same computer - in production,they could be several thousand miles apart, and the client has no idea the server is displaying anything, much less can respond to what it says!
 
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