UserInteractive Mode

  • Thread starter Thread starter Amaryllis
  • Start date Start date
A

Amaryllis

Hello,

I'm trying to check for changes made to a textbox before exiting a
page. If there are changes made, I'm using a messagebox to ask if
the user is sure they want to discard changes made in order to go to
the other page. My problem is that if I try to capture a response, I
get this error messge:

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.

Could someone tell me what this means and if there is a way to get
around this?


Thanks
 
Amaryllis said:
Hello,

I'm trying to check for changes made to a textbox before exiting a
page. If there are changes made, I'm using a messagebox to ask if
the user is sure they want to discard changes made in order to go to
the other page. My problem is that if I try to capture a response, I
get this error messge:

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.

Could someone tell me what this means and if there is a way to get
around this?

You are using System.Windows.Forms.MessageBox. You cannot use anything from
System.Windows.Forms within a Web Form.

Also, I strongly suggest that you abandon the idea of duplicating this sort
of rich client functionality in a web form. If you do, you will find
yourself on a wild goose chase.

If you insist on attempting to duplicate such features, you will need to do
a lot of programming in JavaScript on the client. You will then get to
experience the differences between browsers in their handling of JavaScript.
 
What I've done in the past is create a phony message box using a panel on my web page. I keep it hidden. When I need to pop it up I set the enable property of everything else on the page (easy is everything else is in another panel since you just set the other panels Enable property to false) then I make my Messagebox Panel visible. I then process the OK and Cancel buttons.
 
Back
Top