Jump to content

a error when I want to display a message box


newcomer2006

Recommended Posts

hi, everyone,When I want to dispaly a message box using C#.net (vs.net 2003), I found this error:"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. "My code is: MessageBox.Show("OK!");Can some one help me? thanks in advance!

Link to comment
Share on other sites

You cannot use MessageBox in an ASP.Net project only Windows Projects.use this instead

string js = "<script>alert('OK!')</script>";this.RegisterStartupScript("keyName",js);

Link to comment
Share on other sites

when you say C#.net are you refereing to ASP.Net webforms made with C# or C# Windows Forms?If it is for webforms then no. You cannot use alot of dialog commands, etc on webforms. All popup boxes/messageboxes/confirmation boxes, etc must be done with JavaScript.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...