I don’t often need to prevent a SharePoint 2010 modal dialog window from closing, but when I do I use the code below:
//step 1: check if we are in a dialog
var dlg = typeof (SP.UI.ModalDialog.get_childDialog) == "function" ? SP.UI.ModalDialog.get_childDialog() : null;
if (dlg != null && dlg.$5_0) {
//step 2: hide close button
dlg.$5_0.style.display = "none";
}
Then, when you want to allow the dialog to be closed again, the code is:
//step 1: check if we are in a dialog
var dlg = typeof (SP.UI.ModalDialog.get_childDialog) == "function" ? SP.UI.ModalDialog.get_childDialog() : null;
if (dlg != null && dlg.$5_0) {
//step 2: show close button
dlg.$5_0.style.display = "inherit";
}
No comments:
Post a Comment