How do you display a msgBox in a web application?

G

Guest

I've tried the good old fashioned msgBox but 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.
 
M

Mike Labosh

I've tried the good old fashioned msgBox but 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.

In server-side code, you can't.

On the client,

<script language="JavaScript">
<!--
alert("Your message here");
-->
</script>

or

<script language="VBScript">
MsgBox "Your Message Here"
</script>

But note that some browsers don't like VB Script.
 
C

Cor Ligthert

Roman,

Maybe this can help you as well?

Private Sub Page_Load(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim str As String = "<script language " & _
"=javascript>alert('Click on the button?');</script>"
Page.RegisterStartupScript("Startup", str)
End If
Me.Button1.Attributes("onClick") = _
"alert('I hope this helps a little bit?')"
End Sub
///

Cor
 
G

Guest

Thanks Richard!

I like the Scott articles and contributions very much.
I didn't know about this.

Thanks a lot!

Jorge
 
G

Guest

You guys have been great. Thanks again.

Cor Ligthert said:
Roman,

Maybe this can help you as well?

Private Sub Page_Load(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim str As String = "<script language " & _
"=javascript>alert('Click on the button?');</script>"
Page.RegisterStartupScript("Startup", str)
End If
Me.Button1.Attributes("onClick") = _
"alert('I hope this helps a little bit?')"
End Sub
///

Cor
 

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

Top