0

I am calling this method when the cancel button is clicked to close a form in SharePoint. When the modal is closed, it also refreshes the page. Is there any way to prevent the refresh through the code behind?

protected void closeModal()
{
     Page.ClientScript.RegisterStartupScript(this.GetType(), "return", "<script language='JavaScript'>window.frameElement.commonModalDialogClose();</script>");
}
0
protected void closeModal()
{
     Page.ClientScript.RegisterStartupScript(this.GetType(), "return", "<script language='JavaScript'>window.frameElement.commonModalDialogClose(); return false;</script>");
}

add return false at the end should do the trick.

0
function openDialog(tUrl, tTitle) {
                 debugger;
                 var url = _spPageContextInfo.webServerRelativeUrl;
                 url = url.replace(/\/$/, '') + '/';
                 tUrl = url + tUrl;
                 var options = {
                     url: tUrl,
                     title: tTitle,
                     width: 1200,
                     height: 535
                 };

                 SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
     closeDialog();
   }
function closeDialog()
{
window.frameElement.commitPopup();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.