how to display a MessageBox in ASP.net

P

Paul Wilson

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
 
S

Steve C. Orr [MVP, MCSD]

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/d...mWebUIPageClassRegisterStartupScriptTopic.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
 
L

Lau Lei Cheong

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top