473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to display a MessageBox in ASP.net

Hi guys,

Can someone tell me how i could display a messagebox in ASP.NEt.

Following is what i want to do.
Validate the user details, & if the user doesn't have requried access
rights, then Display a MessageBox informing the user of this.
(or displaying messages when unable to save data on the server, or the
like).

Best Regards,
Paul
Nov 18 '05 #1
3 1732
You can 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.)

RegisterStartupScript("startupScript", "<script
language=JavaScript>alert('This is my message.');</script>");

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

Here are a couple controls you might find to be useful:
http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
http://www.jttz.com/msgbox/index.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Paul Wilson" <pa**@dummyemailaddress.com> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
Hi guys,

Can someone tell me how i could display a messagebox in ASP.NEt.

Following is what i want to do.
Validate the user details, & if the user doesn't have requried access
rights, then Display a MessageBox informing the user of this.
(or displaying messages when unable to save data on the server, or the
like).

Best Regards,
Paul

Nov 18 '05 #2
Hello,

For the codes I've seen three is three way to invoke javascript in ASP
..NET:
1) Using RegisterClientScript();
2) Using RegisterStartupScript();
3) Using HttpContext.Current.Respose.Write();
Perheps there are more ways. :)

Can anyone tell me what are the Pros and Cons of using these methods?

Thanks in advance.

Regards,
Lau Lei Cheong

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> ¦b¶l¥ó
news:%2****************@TK2MSFTNGP10.phx.gbl ¤¤¼¶¼g...
You can 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.)

RegisterStartupScript("startupScript", "<script
language=JavaScript>alert('This is my message.');</script>");

Here's more info:
http://msdn.microsoft.com/library/de...criptTopic.asp
Here are a couple controls you might find to be useful:
http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
http://www.jttz.com/msgbox/index.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Paul Wilson" <pa**@dummyemailaddress.com> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
Hi guys,

Can someone tell me how i could display a messagebox in ASP.NEt.

Following is what i want to do.
Validate the user details, & if the user doesn't have requried access
rights, then Display a MessageBox informing the user of this.
(or displaying messages when unable to save data on the server, or the
like).

Best Regards,
Paul


Nov 18 '05 #3
Try, this is a pretty useful code
http://www.planet-source-code.com/vb...txtCodeId=2492
although much like the same that Steve did
"Steve C. Orr [MVP, MCSD]" wrote:
You can 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.)

RegisterStartupScript("startupScript", "<script
language=JavaScript>alert('This is my message.');</script>");

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

Here are a couple controls you might find to be useful:
http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
http://www.jttz.com/msgbox/index.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Paul Wilson" <pa**@dummyemailaddress.com> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
Hi guys,

Can someone tell me how i could display a messagebox in ASP.NEt.

Following is what i want to do.
Validate the user details, & if the user doesn't have requried access
rights, then Display a MessageBox informing the user of this.
(or displaying messages when unable to save data on the server, or the
like).

Best Regards,
Paul


Nov 18 '05 #4

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

Similar topics

9
by: Wally | last post by:
I am trying to display images from an Access 2000 database and I get an error "Invalid Parameter Used" when I execute the code line "picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual...
1
by: Kevin R | last post by:
I'm running the HelloWorldForm example from Microsoft to learn how to use ..net. I'm using Microsoft Visual Studio .NET 2003, 1.1 framework. I run the HelloWorldForm example. The example runs...
3
by: sdeyoreo | last post by:
How do I display the integer in pt.x in a message box? I get a error on parameter 2 of MessageBox call: char str; sprintf(str,"point x is %d",pt.x); MessageBox(NULL,str,NULL,MB_OK);
3
by: Tee | last post by:
Hi, I have a boolean variable, I need to see it's true or false from a MessageBox.Show, but when I try to compile, I keep on getting error, "cannot convert from 'bool' to 'string'". This is...
7
by: jez123456 | last post by:
Hi, I have the following method where I need to display which database is being processed, however, the label lblDatabase dosn't seem to work until the end. private void...
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
2
by: soundar rajan | last post by:
Hi, I wanna display messagebox, and also at the bottom i wanna display "Dont show again" with checkbox using VB.NET. Immediate help needed!!!!
14
by: A.A. Fussy | last post by:
What code would I use for displaying a message box in VB.NET
3
by: Amanda | last post by:
Can anyone help me to display the output in MessageBox for the following program result?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.