1

When I display message box using msgbox ("Show my message") in asp.net webforms, it does show it but in minimized state.
How to display it normally as we get it in winforms?

Thanks

3 Answers 3

3

You can't use a msgbox (it may work when you're testing the application locally because your machine is both the client and the server, but if you tried to deploy it, it may only open a msgbox on the server).

You can use javascript, like this:

SomethingClickable.Attributes["onClick"] = "alert('Hello World');";
Sign up to request clarification or add additional context in comments.

Comments

2

You can't display a server side MessageBox in a web application. You can use the javascript alert dialog, a modal dialog, a UserControl, or a block of text on your page instead.

The simplest method is probably alert:

<script type='text/javascript'>
  alert("Show my message");
</script>

Comments

1

You can't directly display e message box on the client from the server. You need to use JavaScript code which happens to be

alert("Show my message");

However you can't put that directly in the VB code. You should somehow render it on the page and if you need it as a result of some interaction you should handle that interaction again on the client. If you need code to run on the server the user should either refresh the page and be greated with the message box when it loads or you should use some kind of AJAX (UpdatePanel, services, etc.)

Moral of the story: the web is not the desktop.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.