By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,835 Members | 1,521 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,835 IT Pros & Developers. It's quick & easy.

how to display a MessageBox in ASP.net

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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> bl
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.