1

I am using the following code to generate a popup window once a hyperlink has been clicked:

currentUserLink.NavigateUrl = "javascript:OpenPopUpPage('/_Layouts/newTest/PopUpEditor.aspx');";

Since i wish that the parent window to be refresshed on closing the popup window i used the window.onunload and applied the following code :

<script type="text/javascript">
    window.onunload = function () {
        window.opener.location.reload();
    };
</script>

yet the following code is not working. What is missing in the code?

1 Answer 1

2

try this code..

function ShowModal() {
    ExecuteOrDelayUntilScriptLoaded(function () {
        var options = {
            url: 'servername/webpart.aspx',
            tite: 'Add Vendor',
            width: 800,
            height: 475,
            allowMaximize: true,
            showClose: true,
            dialogReturnValueCallback: scallback
        };
        SP.UI.ModalDialog.showModalDialog(options);
    }, 'sp.js');
 }

 function scallback(dialogResult, returnValue) {
      if (dialogResult == SP.UI.DialogResult.OK) {
           SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
      }

Source : SP.UI.ModalDialog.RefreshPage from the dialog itself?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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