473,659 Members | 2,636 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying Message Boxes

Can a message box be displayed using asp.net code? I know there is a
System.Windows. Forms.MessageBo x but i cant use it in my web pages, I always
get an error message saying that Windows cannot be found in System
namespace.
Nov 18 '05 #1
5 1386

No, The Windows.Forms.M essagesBox (and all other Windows.Forms.* )
are not working under Web.......

Simply use a Clientside JavaScript or VBScript

javascript: alert('Hello');
vbscript: Msgbox "Hello"
"Paul Johnson" <Pa**@pgj99.fre eserve.co.uk> schrieb im Newsbeitrag
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
Can a message box be displayed using asp.net code? I know there is a
System.Windows. Forms.MessageBo x but i cant use it in my web pages, I always get an error message saying that Windows cannot be found in System
namespace.

Nov 18 '05 #2
Producing a MessageBox by the .NET Framework on an ASP.NET page is an
impossibility because messageboxes are a function of the browser, not the
server.

You need to use traditional client-side script to produce a messagebox in
the browser.
"Paul Johnson" <Pa**@pgj99.fre eserve.co.uk> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
Can a message box be displayed using asp.net code? I know there is a
System.Windows. Forms.MessageBo x but i cant use it in my web pages, I always get an error message saying that Windows cannot be found in System
namespace.

Nov 18 '05 #3
You can *simulate* a message box with client-side code. There are controls
like this that help you design the boxes:

http://www.asp.net/ControlGallery/Co...860&tabindex=2

"Paul Johnson" <Pa**@pgj99.fre eserve.co.uk> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
Can a message box be displayed using asp.net code? I know there is a
System.Windows. Forms.MessageBo x but i cant use it in my web pages, I
always
get an error message saying that Windows cannot be found in System
namespace.


Nov 18 '05 #4
There is a solution I used in one asp.net application:

In page's html insert hidden field and name it, say,
hidField. Give it attribute runat="server";
in c# (vb) class (code behind) for this page declare this
hidden field like this:

protected System.Web.UI.H tmlControls.Htm lInputHidden
hidField;

Then use its value attribute to give it any message you
need when you need. Say, hidField.Value = "Freaking
message";

Then insert a script function inside of your html,
something like this:

<script>
function checkError()
{
if(document.all .hidField && document.all.hi dField.value !
= "")
alert(hidField. value);
hidField.value = "";
}
</script>

And finally add onLoad event (jscript event) to your body
tag in your html:

<body onLoad="checkEr ror();">

Now every time you need to send any message from your c#
(vb) to the client, just assign any string to the hidField
value in your c# (vb).

That's it.

Regards.
-----Original Message-----
Can a message box be displayed using asp.net code? I know there is aSystem.Windows .Forms.MessageB ox but i cant use it in my web pages, I alwaysget an error message saying that Windows cannot be found in Systemnamespace.
.

Nov 18 '05 #5
Execute a line of code like this when you want a message box to be
displayed.
(This writes out the necessary client side javascript to your HTML page to
make the alert pop up as soon as the page is sent to their browser.)

RegisterStartup Script("startup Script", "<script
language=JavaSc ript>alert('Thi s is my message.');</script>");

Here's more info:
http://msdn.microsoft.com/library/de...criptTopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Paul Johnson" <Pa**@pgj99.fre eserve.co.uk> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
Can a message box be displayed using asp.net code? I know there is a
System.Windows. Forms.MessageBo x but i cant use it in my web pages, I always get an error message saying that Windows cannot be found in System
namespace.

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2785
by: Paul M | last post by:
Hi there, i hope someone can help me out here.. I have a input screen where i want the user to enter text in 2 different languages, english and macedonian. How is it possible to make the macedonian input boxes so when you type into them, it is entered into macedonian font? I dont want the users to be downloading anything also. thanks,
1
1694
by: Nick | last post by:
Hey, Needed some pointers on how I can get to display pop up bubbles in a windows form that I am building. I basically require these as tooltips for a user. I'm currently planning to call the code for displaying these on focus on text boxes. Nick
3
9360
by: B | last post by:
I know there are several ways to speed up combo boxes and form loading. Most of the solutions leave rowsource of the combo box blank and set the rowsource to a saved query or an SQL with a where clause after users typed in one or several letters/digits. My problem is as follows Most of the time I need to display form in continuous format, that means the combo box will appear in each record. For example I have a form to let users view...
3
2492
by: duncan | last post by:
I have a text box on a web form here is the HTML for it :- <asp:textbox id="winPts" style="LEFT: 170px; POSITION: absolute; TOP: 80px" runat="server" Width="24px" maxlength="2"></asp:textbox> This is one of several such boxes. The problem I have is on my lap top using Viual Studio 2003 the text boxes display as intended. I have copied the source code across to my desktop and when I run the page using Visula Studio 2003 the form...
3
13409
by: Schapopa | last post by:
Hello, I have form where I want to display data from one record. So I created stored procedure with parameter and I populated some dropdown boxes with data, and now I would like to display that record in the textboxes and combo boxes. So I have data conection, data adapter and query with parameter. How do I bind this to textboxes and dropdown boxes. textbox.text = ?? I guess what I cannot find is how to point to specific field in the...
2
1192
by: JR | last post by:
I have tried searching boards but have not been able to find an answer. What is the best way to display text from a log.txt file and then display it in three seperate text boxes? I have a log file that is continually going to have 3 temperatures appended to it. I need to read that temperature in from the log file and display it to the user. The temperatures are seperated by commas. I was reading and is Streamreader
5
10511
by: Bill | last post by:
Hello, Could anyone post some simple code or advise me on how I can display the SSN number like *****7890 in a text box, even thought the user entered 1234567890, and the value of the variable would remain the same. Only thing I can think of is, accept the user input load it into a varible, and then just take the last 4 digits of the number and concatenate it to 5 *'s and replace the text box variable with that.... I was hoping there was a...
2
1258
by: moumita | last post by:
I have the folowing code..the logic according to me is correct..but I dont know...the msg boxes are not displaying anything...am I supposed to change any settings ??? Public Class Form1
0
2909
by: Del | last post by:
Hello and thanks for any and all assistance! I have a database that is used by several users on several different machines. The backend database is housed on a file server. Each user has a front end on their local machine. The main form of the database has several query driven combo boxes. These queries pull data from the back end database to populate the combo boxes.
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8751
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8539
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.