I created a button on a small app I'm building and can't use MessageBox.Show b/c I am using Web not Windows. Does anyone know how I can get my message to display using C#?
Asked
Active
Viewed 2,060 times
1 Answers
0
MessageBox is for Windows apps. Use JavaScript for message boxes in web apps. alert('hello world');
The C# code is processed on the back end by the web server, which doesn't show message boxes to the end user. JavaScript is processed by the browser which does show message boxes to the end user. You have to use JavaScript to show a message box to the user. Does that make sense?

edtheprogrammerguy
- 5,957
- 6
- 28
- 47
-
Exactly, which is why i said i can't use it. I figured that. not a pro in javascript. Do you know what code i would use? – user2788948 Sep 17 '13 at 19:17
-
it does. but i don't know what code to use. – user2788948 Sep 17 '13 at 19:29
-
`alert('hello world');` – edtheprogrammerguy Sep 17 '13 at 19:30
-
alert doesn't exist in the current context is the error msg i'm getting. I'm using C# as code behind of an ASP.Net website. – user2788948 Sep 17 '13 at 19:52
-
See this page for an example: http://msdn.microsoft.com/en-us/library/btf44dc9.aspx. Put `alert` in the – edtheprogrammerguy Sep 17 '13 at 20:01