hi all,
how do we display a messagebox in ASP.net. i tried in this way

MsgBox("<script language='javascript'>successfully saved</script>")

but it displays a error message saying

"
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. "



can anyone help me out in solving this problem. :!:

Remember that this code is running on the web server in a process that is not running as the currently logged on (to the server) user. Therefore the process will be running under its own Window Station, and will not be able to interact with the desktop in any way. Consequently, you cannot display a MessageBox on the server without setting the flags to indicate that you want to display it on the currently logged in user's Window Station (effectively the default desktop).

Typically, displaying message boxes on servers is regarded as a very bad thing, as a lot of servers are locked in computer rooms and there is no user to dismiss them. Therefore, are you really sure that you want to do this, or would you really prefer to display a message box on the browser (using client-side JavaScript)?

Source

hi all,
how do we display a messagebox in ASP.net. i tried in this way

MsgBox("<script language='javascript'>successfully saved</script>")

but it displays a error message saying

"
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. "

can anyone help me out in solving this problem. :!:

-------------------------------------------------------

well you can add an attribute to a button in Page_Load so a javascript function is fired to show you the message box:

button.Attributes.Add("onclick","ShowMessage();");

in JavaScript:

function ShowMessage()
{
alert("successfully saved");
}

hope this is what you need.

cheerz

hi all, can you please guide me about how i can display msg like"Are you sure you to delete? yes/no" in asp.net

if we add the given code in the page_laod event den the msg box will be displayed irrespective of the user input if we actaully want to be proceed as such.So wat will be d soln for d same,display msg box based on the user input.

Showing message at server is not a good idea. u can use javascript like this

Me.Page.RegisterStartupScript("MessageID", "<script>errBody = 'Your Message Body'; errTitle = 'Message Box Title';</script>")

Mohammed Yousuf uddin
Software Developer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.