This question was asked a few years ago, so I'm going to ask it again.
I'm looking for the best/cleanest option to display a modal popup window upon the click event of an ASP Button control. The contents of the window will be an aspx page.
Cross-browser compatibility is a requirement
jquery/plugins aren't out of the question if they fit the mold.
Step 1 : Start a new ASP.NET MVC Web application. Add a new controller called Home and in the Home controller, the Index method is available to you but there is not a view with it so add a view by right-clicking in Index action. Step 2 : In index. aspx add one HTML button to open our modal popup window like below.
There are few ways to close modal in Bootstrap: click on a backdrop, close icon, or close button. You can also use JavaScript hide method. Click the button to launch the modal. Then click on the backdrop, close icon or close button to close the modal.
Yes and no. Native blockers definitely don't do it, they work only with the pop-ups that open in new windows/tabs. Adblockers can be configured to block them by classname or id or some other way to identify them, but they definitely don't block bootstrap modals out of the box.
Add logic to the click event to re-open the modal after the post back OR look for an alternative method of posting back to the server such as using AJAX. If you want to do it via AJAX, remove the OnClick event from the button. Add a [WebMethod] to your code behind and call that webmethod using $. ajax.
There are a host of options in the jQuery field:
jQueryUI's dialog
Wijmo's Dialog
SimpleModal
These are just three options out of many. jQueryUI is pretty easy to use out of the box, but isn't as customizable (or easy to) and "pretty" as SimpleModal. At their core, their pretty much all very similar.
If you'd already using jQuery, jQueryUI's option may be a good fit. Wijmo is also jQueryUI compatible/friendly (use the same theme CSS class names and patterns), so it's also a good fit.
So it kind of depends on what you want. Something very simple - maybe jQueryUI. Flashy/pretty -- SimpleModal. More complex but jQueryUI-friendly - Wijmo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With