how to display a MessageBox in ASP.net

Discussion in 'ASP .Net' started by Paul Wilson, Jun 21, 2004.

  1. Paul Wilson

    Paul Wilson Guest

    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
    Paul Wilson, Jun 21, 2004
    #1
    1. Advertising

  2. 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

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



    "Paul Wilson" <> wrote in message
    news:ulSk7$...
    > 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
    >
    >
    Steve C. Orr [MVP, MCSD], Jun 21, 2004
    #2
    1. Advertising

  3. 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]" <> ¦b¶l¥ó
    news:% ¤¤¼¶¼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/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
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://Steve.Orr.net
    >
    >
    >
    > "Paul Wilson" <> wrote in message
    > news:ulSk7$...
    > > 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
    > >
    > >

    >
    >
    Lau Lei Cheong, Jun 21, 2004
    #3
  4. Try, this is a pretty useful code
    http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=10&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/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
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://Steve.Orr.net
    >
    >
    >
    > "Paul Wilson" <> wrote in message
    > news:ulSk7$...
    > > 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
    > >
    > >

    >
    >
    >
    =?Utf-8?B?QW5vdGhlciBvcHRpb24=?=, Jun 21, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden

    messagebox in ASP.NET using VB.NET

    Matthew Louden, Oct 22, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    10,110
    Kevin Spencer
    Oct 22, 2003
  2. soundar rajan
    Replies:
    2
    Views:
    3,528
    =?Utf-8?B?RG90TmV0SmVyb21l?=
    Feb 24, 2005
  3. Replies:
    3
    Views:
    6,651
  4. Steve Kershaw

    How can I display a MessageBox in ASP.NET?

    Steve Kershaw, May 26, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    3,903
    Steve C. Orr [MVP, MCSD]
    May 26, 2006
  5. Matthew Louden

    messagebox in ASP.NET using VB.NET

    Matthew Louden, Oct 22, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    1,346
    Kevin Spencer
    Oct 22, 2003
Loading...

Share This Page