Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0 C# C#4.0
I want to use messagebox.show("") in my web app
but gives me this error:
Compiler Error Message: CS0234: The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)
 
Source Error:
 

Line 8: using System.Configuration;
Line 9: using System.Data;
Line 10: using System.Windows.Forms;
Line 11:
Line 12: namespace Csharp
Posted 7-Dec-12 4:11am
Comments
Fredrik Bornander at 7-Dec-12 9:47am
   
You don't want to do that. It's a bad idea.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The web will not support showing a messagbox this way. The C# code runs on the server and generates HTML which is sent to the client and then the browser renders the HTML. If you want to show a message to the user you need to use JavaScripts alert[^] or use a jQuery plugin.
  Permalink  
Comments
Annnaa at 7-Dec-12 9:55am
   
i used this and works perfectly
Response.Write(@"<script language='javascript'>alert('First Record') </script>");
ryanb31 at 7-Dec-12 9:55am
   
Yes, that will work. If it will ever be more complex than that you'll want to create a JavaScript file and functions but for simple things, that will work fine.

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

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 230
2 BillWoodruff 205
3 Sergey Alexandrovich Kryukov 195
4 DamithSL 165
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,650
3 Kornfeld Eliyahu Peter 3,460
4 Sergey Alexandrovich Kryukov 2,811


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100