Click here to Skip to main content
12,064,812 members (41,321 online)
Rate this:
 
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 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 7-Dec-12 9:55am
   
i used this and works perfectly
Response.Write(@"<script language='javascript'>alert('First Record') </script>");
ryanb31 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web03 | 2.8.160204.4 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2016
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