Thursday, September 18, 2014

SharePoint 2013 Modal Dialog with parent page refresh


<script type="text/javascript">

function ShowModal() {

    ExecuteOrDelayUntilScriptLoaded(function () {

        var options = {

            url: 'http://sharepointsite.com/sites/devsite/Lists/Project%20Tasks/DispForm.aspx?ID=2&Source=http%3A%2F%2Frmitscvpspqa02%3A1000%2Fsites%2Fdevsite%2FLists%2FProject%2520Tasks%2FAllItems%2Easpx&ContentTypeId=0x010800EFF7689E39CAEB4C9BF59AEB73ABEFA9',

            tite: 'Add Vendor',

            width: 800,

            height: 475,

            allowMaximize: true,

            showClose: true,

            dialogReturnValueCallback: scallback

        };

        SP.UI.ModalDialog.showModalDialog(options);

    }, 'sp.js');

 }



 function scallback(dialogResult, returnValue) {

      alert(dialogResult);

      SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);



      if (dialogResult == SP.UI.DialogResult.OK) {

           alert('Ok');

           SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);

           }

      }

          

      </script>

<input onclick="javascript:ShowModal();" type="button" value="Model Popup"/>

No comments:

Post a Comment