Oops, correction:
window.open('You should enter more than one criteria');
should be
alert('You should enter more than one criteria');
Sorry about that.
John
Main Topics
Browse All TopicsHi all
I made an asp.net app and need message box to notify user for something.
IF user enter only one or none search criteria, message should looks like "You should enter more than one criteria!". I tried with MessageBox.Show, but I get an error "Name 'MessageBox' is not declared". When I tried with msgbox, I get an 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." How can I use message box?
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
In a Windows app, the base class for a form is System.Windows.Forms. This is the namespace that has the MessageBox class that you use in VB.NET for Windows apps. It in turn interacts with the Windows operating system to draw the message box with the message, icon and button you specify. In a windows app, you always know you have a windows OS under the hood.
But with an ASP.NET app, the System.Web.UI namespace has a Page class that the web form inherits. The Page class does not interact with the Windows OS to draw the box. It's purpose is to configure HTML for IIS to send to the browser. Where with VB.NET for windows you know your undelrying OS is going to be windows, with an ASP.NET app and a browser for the client, it may be on a unix box, a mac, or Linux, or who knows what. So the only thing you know is that you will have a client capable of rendering HTML, and with some variations, capable of executing JavaScript. And for security reasons, you also know the browser is not going to expose the underlying OS of the client's machine for you send the instructions ncessary to show a message box.
So if you want the browser to show a message box, you can be reasonable sure that the client's version of JavaScript will know how to respond to the alert() function. But you have to tell the Page class to stream that function to the browser (RegisterStartupScript() is provided for just that purpose). The way the browser knows you are sending it a JavaScript command is to have it embedded in the <script></script> tag as my initial response shows.
Remember two things: 1) Everything you put in an ASP.NET page that is an xml definition of a server control (like <asp:TextBox></asp:TextBox
John
Business Accounts
Answer for Membership
by: jnhorstPosted on 2004-10-10 at 10:09:53ID: 12271817
MessageBox is for windows apps only. The way to do this in ASP.NET is as follows:
ow.open('Y ou should enter more than one criteria');</script>" box", js)
Dim js As String = "<script language='javascript'>wind
RegisterStartupScript("msg
Put this code where you would otherwise have the MessageBox() call. It will add this script block, which will cause a message box-like dialog to show from the browser.
John