474,116 Members | 2,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

messagebox in asp.net? how?

Hi everyone!

Never before have I had so many problems displaying a message to the user
(being a programmer for the last 4 years)!

What I would like to do is show a message e.g. when a procedure fails, etc.

Tried searching google, tried with divs, managed to 'implant' a div in my
master page to show info and error messages,
but I have two problems with it:
1) dropdown's display on top of this div!
2) can't produce confirm div (stop the javascript code and wait for user
interaction)

So, what would you suggest - recommend me?

Thanks in advance!
Mar 15 '07 #1
23 1646
"patrickdrd " <pa********@dis cussions.micros oft.comwrote in message
news:97******** *************** ***********@mic rosoft.com...
So, what would you suggest - recommend me?
The two JavaScript methods you need are 'alert' and 'confirm'

http://www.google.co.uk/search?sourc...vaScript+alert
http://www.google.co.uk/search?hl=en...G=Search&meta=
Mar 15 '07 #2
Since your ASP.NET code runs on the server and it is the client that is
responsible for messageboxes/confirms/alerts, you can't use server-side code
to do this directly.

The simplest thing to do is just to put an ASP:Label control on the page in
the position you *would* want the message to go, but leave its text property
blank Then, when your server-side code needs to send the client a message
simply fill in the text property of the label. Remember to set the label's
EnableViewState property to false so you don't see old messages.

Or, you could use server-side code to produce client-side javascript, which
could make your messagebox for you:

If someTest Then
response.write( "<SCRIPT LANGUAGE='JavaS cript'>alert('Y ou have done
something bad! ')</SCRIPT>")
End If

-Scott

"patrickdrd " <pa********@dis cussions.micros oft.comwrote in message
news:97******** *************** ***********@mic rosoft.com...
Hi everyone!

Never before have I had so many problems displaying a message to the user
(being a programmer for the last 4 years)!

What I would like to do is show a message e.g. when a procedure fails,
etc.

Tried searching google, tried with divs, managed to 'implant' a div in my
master page to show info and error messages,
but I have two problems with it:
1) dropdown's display on top of this div!
2) can't produce confirm div (stop the javascript code and wait for user
interaction)

So, what would you suggest - recommend me?

Thanks in advance!

Mar 15 '07 #3
sorry about that, but I forgot to mention that I need to display server side
messages...

I already use and know about alert and confirm in javascript

"Mark Rae" wrote:
"patrickdrd " <pa********@dis cussions.micros oft.comwrote in message
news:97******** *************** ***********@mic rosoft.com...
So, what would you suggest - recommend me?

The two JavaScript methods you need are 'alert' and 'confirm'

http://www.google.co.uk/search?sourc...vaScript+alert
http://www.google.co.uk/search?hl=en...G=Search&meta=
Mar 15 '07 #4
thanks! I'll try them both!

One last thing though:
can I use absolute positioning to show the label on the center of the user's
screen?

"Scott M." wrote:
Since your ASP.NET code runs on the server and it is the client that is
responsible for messageboxes/confirms/alerts, you can't use server-side code
to do this directly.

The simplest thing to do is just to put an ASP:Label control on the page in
the position you *would* want the message to go, but leave its text property
blank Then, when your server-side code needs to send the client a message
simply fill in the text property of the label. Remember to set the label's
EnableViewState property to false so you don't see old messages.

Or, you could use server-side code to produce client-side javascript, which
could make your messagebox for you:

If someTest Then
response.write( "<SCRIPT LANGUAGE='JavaS cript'>alert('Y ou have done
something bad! ')</SCRIPT>")
End If

-Scott

"patrickdrd " <pa********@dis cussions.micros oft.comwrote in message
news:97******** *************** ***********@mic rosoft.com...
Hi everyone!

Never before have I had so many problems displaying a message to the user
(being a programmer for the last 4 years)!

What I would like to do is show a message e.g. when a procedure fails,
etc.

Tried searching google, tried with divs, managed to 'implant' a div in my
master page to show info and error messages,
but I have two problems with it:
1) dropdown's display on top of this div!
2) can't produce confirm div (stop the javascript code and wait for user
interaction)

So, what would you suggest - recommend me?

Thanks in advance!


Mar 15 '07 #5
See my second suggestion in my other reply.
"patrickdrd " <pa********@dis cussions.micros oft.comwrote in message
news:2C******** *************** ***********@mic rosoft.com...
sorry about that, but I forgot to mention that I need to display server
side
messages...

I already use and know about alert and confirm in javascript

"Mark Rae" wrote:
>"patrickdrd " <pa********@dis cussions.micros oft.comwrote in message
news:97******* *************** ************@mi crosoft.com...
So, what would you suggest - recommend me?

The two JavaScript methods you need are 'alert' and 'confirm'

http://www.google.co.uk/search?sourc...vaScript+alert
http://www.google.co.uk/search?hl=en...G=Search&meta=

Mar 15 '07 #6
"Scott M." <s-***@nospam.nosp amwrote in message
news:Oe******** ******@TK2MSFTN GP06.phx.gbl...
response.write( "<SCRIPT LANGUAGE='JavaS cript'>alert('Y ou have done
The language attribute of the <scripttag has been deprecated for ages, and
will break W3C validation - don't use it...

Use <script type="text/javascript".... .instead:
http://www.w3.org/TR/html4/interact/....html#h-18.2.1
Mar 15 '07 #7
Sure, you would need to use your own client-side JavaScript to determine the
center of the screen though and set the label's position prior to populating
it. You can also use a label's visible property to show/hide it as
necessary.


"patrickdrd " <pa********@dis cussions.micros oft.comwrote in message
news:FC******** *************** ***********@mic rosoft.com...
thanks! I'll try them both!

One last thing though:
can I use absolute positioning to show the label on the center of the
user's
screen?

"Scott M." wrote:
>Since your ASP.NET code runs on the server and it is the client that is
responsible for messageboxes/confirms/alerts, you can't use server-side
code
to do this directly.

The simplest thing to do is just to put an ASP:Label control on the page
in
the position you *would* want the message to go, but leave its text
property
blank Then, when your server-side code needs to send the client a
message
simply fill in the text property of the label. Remember to set the
label's
EnableViewStat e property to false so you don't see old messages.

Or, you could use server-side code to produce client-side javascript,
which
could make your messagebox for you:

If someTest Then
response.write( "<SCRIPT LANGUAGE='JavaS cript'>alert('Y ou have done
something bad! ')</SCRIPT>")
End If

-Scott

"patrickdrd " <pa********@dis cussions.micros oft.comwrote in message
news:97******* *************** ************@mi crosoft.com...
Hi everyone!

Never before have I had so many problems displaying a message to the
user
(being a programmer for the last 4 years)!

What I would like to do is show a message e.g. when a procedure fails,
etc.

Tried searching google, tried with divs, managed to 'implant' a div in
my
master page to show info and error messages,
but I have two problems with it:
1) dropdown's display on top of this div!
2) can't produce confirm div (stop the javascript code and wait for
user
interaction)

So, what would you suggest - recommend me?

Thanks in advance!



Mar 15 '07 #8
"patrickdrd " <pa********@dis cussions.micros oft.comwrote in message
news:2C******** *************** ***********@mic rosoft.com...
sorry about that, but I forgot to mention that I need to display server
side
messages...
Take a step back here...

How can you display anything on a server...?

Even if you did manage to display a message server-side, who would ever see
it...? Your users certainly wouldn't...:-)
Mar 15 '07 #9
So will the following:

FONT
FACE
SIZE
COLOR
BLOCKQUOTE
BGCOLOR

etc., etc, etc.

If you are using HTML or XHTML Transitional (as millions do), this will not
pose any problem.

"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
"Scott M." <s-***@nospam.nosp amwrote in message
news:Oe******** ******@TK2MSFTN GP06.phx.gbl...
> response.write( "<SCRIPT LANGUAGE='JavaS cript'>alert('Y ou have done

The language attribute of the <scripttag has been deprecated for ages,
and will break W3C validation - don't use it...

Use <script type="text/javascript".... .instead:
http://www.w3.org/TR/html4/interact/....html#h-18.2.1

Mar 15 '07 #10

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

Similar topics

11
541
by: Rich Tasker | last post by:
I have a strange situation. A simple call to MessageBox.Show("XXX", "YYY") does not display the message in the messagebox with a visible font. Based on the content of the messagebox, the box sizes properly so I know there is a message in there. I also found a keyboard shortcut where <ctrl>+<insert> will copy the contents of the messagebox to the clipboard in plain text. I see my messagebox text in the clipboard contents but not in the...
8
13136
by: Dennis C. Drumm | last post by:
I have ordered the book .NET Framework Solutions, In Search of the Lost Win32 API by John Paul Meuller which I think will help answer some of my questions I have regarding making custom MessageBoxes, but that isn't going to be here for a few days. So, I thought I would ask you guys how to put one of hte standard MessageBox icons, such as MessageBoxIcon.Exclamation, into my custom MessageBox. Thanks,
2
30199
by: Dennis C. Drumm | last post by:
This is a restatement of an earlier post that evidently wasn't clear. I am building a custom MessageBox dialog that has, among other things, a few new button options (yes to all, no to all, etc.) and would like to make the dialog look and act like the standard MessageBox. Therefore, I would like to put in the message section the same type of icons found in the MessageBox dialog, such as MessageBoxIcon.Exclamation. In another post here I had...
8
2466
by: Saso Zagoranski | last post by:
Hi! I'm trying to make my own MessageBox... What I would like to know is, how the MessageBox class is implemented? I could have something like: new MyMessageBox().ShowDialog(); but I would like the solution used by MessageBox, where you call the static Show() method, which returns a DialogResult value...
4
1952
by: Tressa | last post by:
I have a messagebox that I only want to pop up only if it is not already being displayed on the screen. My code is still poping up the messagebox even though it is on the screen. What am I doing wrong here. Any suggestions on how to fix this using System; using System.Collections; using System.ComponentModel;
3
7452
by: Sin | last post by:
I'm currently evaluating VC.NET as the new platform for the company I work for and things are looking grim... We're up against another IDE which took me about 5 minutes to master and I've been bitching at .NET for the whole day now not being able to do something as simple as showing a textbox's content in a damn MessageBox... The TextBox.Text is a String... MessageBox takes a LPCSTR (plain single byte char*)... All our current code base...
0
4092
by: alex_f_il | last post by:
The class centers MessageBox inside the parent rectangle. Enjoy! using System; using System.Windows.Forms; using System.Text; using System.Drawing; using System.Runtime.InteropServices; namespace Utils {
20
8960
by: Peter E. Granger | last post by:
I'm having a strange problem (or at least it seems strange to me) trying to display a MessageBox in a VC++ .NET forms application. If I put the call to MessageBox::Show in the form's .h file, it works just fine. If I put the call in the .cpp file, I get the following two errors: error C2653: 'MessageBoxA': is not a class or namespace name error C2660: 'System::Windows::Forms::Control::Show': function does not take
10
2379
by: Russ | last post by:
I've been trying to figure out how to show a simple messagebox with an OK button in my web client program (C#). I have looked at every reference to JScript and MessageBox that seemed even remotely like it could help, both in the VS help and in this NG. I found lots of examples of people saying how easy it is and showing examples, and examples in the help. But I have two problems: 1. All the examples show all the code in HTML, usually...
4
2023
by: Larry Woods | last post by:
I have a Messagebox that looks like: MessageBox.Show("There are pending changes for this patient. Do you want to continue to close?", "Pending Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question) When I execute the Messagebox.Show, then press either 'Yes' or 'No' I get 25 of the following Messageboxes: "incorrect syntax near the keyword WHERE"
0
10694
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...
1
12389
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
11278
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...
1
8894
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
8055
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();...
1
6889
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...
1
5605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
5085
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
4175
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.