By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,122 Members | 1,531 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,122 IT Pros & Developers. It's quick & easy.

Client side messagebox

P: 5
Hello

I have a messagebox showing on the click of a button
it is a yes/no message box and so far it works in the localhost with MessageBox.Show

but when I publish the aspx page and run it on the server i get this error

"Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. "

can anyone give me pinters what to do?

thanks for any help
Probi
Aug 4 '08 #1
Share this Question
Share on Google+
1 Reply


DrBunchman
Expert 100+
P: 979
MessageBox.Show will not work for an ASP.NET page because it is a server side message box.

You need to use client side script to fire a message box. Try using the following function instead when you want to display an alert style messagebox:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Message(ByVal sMessage As String)
  2.     Dim myscript As String = "alert('" & sMessage & "');"
  3.     Page.ClientScript.RegisterStartupScript(Me.GetType(), "myscript", myscript, True)
  4. End Sub
If you want to display a confirmation style messagebox then add the following to your asp.net server control:
Expand|Select|Wrap|Line Numbers
  1. OnClientClick="return confirm('Are you sure you want to proceed?');"
Hope this helps,

Dr B
Aug 5 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.