MSGBOX Example

Discussion in 'ASP .Net' started by Chuck Traywick, Jul 29, 2003.

  1. I am trying to get a message box to work in a web form.

    The code looks right

    But when I browse the form I get

    It is invalid to show a modal dialog or form when the
    application is not running in UserInteractive mode.
    Specify the ServiceNotification or DefaultDesktopOnly
    style to display a notification from a service application

    Is there something that explains how to do this.

    I want the user to click a button on a web form and then
    have a prompt to the user and then have the code perform
    based upon the user response.

    Thanks

    Chuck
    Chuck Traywick, Jul 29, 2003
    #1
    1. Advertising

  2. Chuck,

    You have to do this with a javascript confirmation.

    You attach the confirmation to the client side button. Then when the button
    is clicked the confirmation box displays your message. The user can click
    "OK" or "Cancel". If they click ok the form is submitted to the server where
    you can run the code you want to execute in the button's event handler.

    I have example code for how to do this in my web site's code library. Just
    go to www.aboutfortunate.com. In the code library the title of the code you
    need is titled: Attach a javascript confirmation to any VB.Net button

    It's the third entry in the datagrid.

    I hope this helps!

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche
    "Chuck Traywick" <> wrote in message
    news:0c8201c355dc$a69bcba0$...
    > I am trying to get a message box to work in a web form.
    >
    > The code looks right
    >
    > But when I browse the form I get
    >
    > It is invalid to show a modal dialog or form when the
    > application is not running in UserInteractive mode.
    > Specify the ServiceNotification or DefaultDesktopOnly
    > style to display a notification from a service application
    >
    > Is there something that explains how to do this.
    >
    > I want the user to click a button on a web form and then
    > have a prompt to the user and then have the code perform
    > based upon the user response.
    >
    > Thanks
    >
    > Chuck
    >
    S. Justin Gengo, Jul 29, 2003
    #2
    1. Advertising

  3. That's only for windows forms. You don't want that since you're using
    webforms.
    You must use client side code for this since you want you message box to be
    displayed on the client.
    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

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


    "Chuck Traywick" <> wrote in message
    news:0c8201c355dc$a69bcba0$...
    > I am trying to get a message box to work in a web form.
    >
    > The code looks right
    >
    > But when I browse the form I get
    >
    > It is invalid to show a modal dialog or form when the
    > application is not running in UserInteractive mode.
    > Specify the ServiceNotification or DefaultDesktopOnly
    > style to display a notification from a service application
    >
    > Is there something that explains how to do this.
    >
    > I want the user to click a button on a web form and then
    > have a prompt to the user and then have the code perform
    > based upon the user response.
    >
    > Thanks
    >
    > Chuck
    >
    Steve C. Orr, MCSD, Jul 29, 2003
    #3
    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. Mark Newby
    Replies:
    1
    Views:
    1,697
  2. Mendhak [MVP]
    Replies:
    0
    Views:
    582
    Mendhak [MVP]
    May 15, 2005
  3. Emil Kvarnhammar

    Re: msgbox?

    Emil Kvarnhammar, Jul 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    560
    Salim Afþar
    Jul 16, 2003
  4. Salim Afþar

    Re: Grid msgbox?

    Salim Afþar, Jul 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    394
    Salim Afþar
    Jul 16, 2003
  5. Chiu Hung Jung

    MsgBox Error

    Chiu Hung Jung, Aug 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    2,736
    abacnet
    Aug 4, 2003
Loading...

Share This Page