Javascript – Prevent hiding of ModalPopupExtender when ok or cancel is clicked

ajaxasp.netjavascript

I am using an ASP.NET ModalPopupExtender on a page and would like to prevent the dialog from hiding when the user presses the ok button in certain conditions. But I can't seem to find a way.

What I am looking for is something like this

ajax:ModalPopupExtender
...
OnOkScript="return confirm('You sure?')"
...

if confirm is false, then the modal dialog doesn't disappear.

Best Answer

From my understanding in your specific situation you would not wire up the button, and just wire up a script to handle the conditional, then you can close it via JS.