Search This Blog

Wednesday, December 21, 2016

How to pass value from SharePoint modal dialog to Parent window

We can pass the value from SharePoint Modal dialog to its parent window.

After a long search i found the below solution:

Parent Window:

function OpenPopUp() {
                var siteCollectionURL = _spPageContextInfo.siteAbsoluteUrl;
                var options = {
                    url: siteCollectionURL + "/Sitepages/PopUpView.aspx",
                    dialogReturnValueCallback: CloseCallback,
                    height: 900,
                    width: 800
                };
                SP.UI.ModalDialog.showModalDialog(options);
                return false;
            }

function CloseCallback(result, target) {
              ///Value given at Popup window will come as target value
                alert(target);

            }

PopUp window:


function Successclosepopup() {
              var returnValue = "PopUp Successfully Closed";
              SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, returnValue);

            }

Hope this may help you.

Thanks.,


No comments:

Post a Comment

Restricting Custom People Picker to only one Sharepoint group programatically

Refer the following script files in your page,     <!-- For People Picker -->     <script type="text/javascript" src...