Tuesday, December 14, 2010

Refreshing parent page from a child page

I am straggling to refresh parent page on close of modal dialog. Lots of searching and doing rnd I have found following solution. Using following solution you can refresh the parent page and you can also give the text notification.

<script type="text/javascript">
    function demoCallback(dialogResult, returnValue) {
        SP.UI.Notify.addNotification('Your Notification Here...');

        SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
    }
    function popup() {
        var options = {
            url: add_request.aspx',
            tite: 'Add Request',
            allowMaximize: true,
            showClose: true,
            width: 400,
            height: 300,
            dialogReturnValueCallback: demoCallback
        };       
        SP.UI.ModalDialog.showModalDialog(options);
        return false;
    }
</script>