Question

I tried but I guess Message Box only works with win forms. What is the best alternative to use in web forms?

Was it helpful?

Solution

You can use confirm for yes/no questions and alert for "OK" messages in JavaScript.

The other alternative is to use JavaScript to pop up a new window that looks and acts like a message box. Modality in this case varied by browser. In Internet Explorer, the method

window.showModalDialog(url,name,params)

will display a modal dialog. The Mozilla approach is to still use

window.open(url,name,params)

but add modal=yes to the params list.

OTHER TIPS

result = confirm('Yes or no question here.')

JavaScript:

alert("This box has an OK button.");

The Ajax ModalPopup also works nicely. Here is an example:

http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx

You have dojo dialog widget: http://www.dojotoolkit.org/ and you can use it as a message box.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top