Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default MSGBOX Example

    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 Guest

  2. Similar Questions and Discussions

    1. Msgbox in User COntrol
      I have created a user control with an event procedure for a button in the code behind module. Code in this procedure uses the MsgBox function to...
    2. msgbox title
      In my ASP script I call Javascript for a msgbox after the user has submitted the form of their resume information. I saw this example as a way to...
    3. MsgBox Error
      Hi, everyone I use MsgBox("message") function, but error as follows: It is invalid to show a modal dialog or form when the application is not...
    4. Grid msgbox?
      I found it. private void grd_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) {...
    5. msgbox?
      Try adding this code to your Page_Load event: btnSave.Attributes.Add("OnClick", "return confirm('Are you sure you want do save?');"); Good...
  3. #2

    Default Re: MSGBOX Example

    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 [url]www.aboutfortunate.com[/url]. 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:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Chuck Traywick" <ctrawick@uslec.net> wrote in message
    news:0c8201c355dc$a69bcba0$a301280a@phx.gbl...
    > 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 Guest

  4. #3

    Default Re: MSGBOX Example

    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:
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIPageClassRegisterStartupScriptTopi c.asp[/url]

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


    "Chuck Traywick" <ctrawick@uslec.net> wrote in message
    news:0c8201c355dc$a69bcba0$a301280a@phx.gbl...
    > 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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139