Thursday, May 21, 2015

Modern Dialogue in ASPX or SharePoint forms

Modern Dialogue in ASPX or SharePoint forms


<p><a href="javascript:portal_openModalDialog();">My link</a></p>
<script>
    function portal_openModalDialog() {
        var options = {    
            url: SP.Utilities.Utility.getLayoutsPageUrl('#' + location.href),    
            title: 'Edit web info',    
            allowMaximize: false,    
            showClose: true,    
            width: 800,    
            height: 330,    
            dialogReturnValueCallback: Function.createDelegate(null, 
                function (result, returnValue) {        
                    if (result == SP.UI.DialogResult.OK) {            
                        if (returnValue == null) {                
                            SP.UI.Notify.addNotification('Operation successful');                
                            SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);            
                        }            
                        else {                
                            location.href = returnValue;            
                        }        
                    }    
                }
            )
        }; 
        SP.UI.ModalDialog.showModalDialog(options);
    }
</script>

No comments:

Post a Comment