Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to open the "OOB" AssetPortalBrowser.aspx from a page within a SharePoint native modal popup.

My aim is to get the selected filename back to the script. So far I was able to open the popup with the AssetPortalBrowser.aspx, but I don't know how to "close" the popup while clicking the built-in "OK" button on the AssetPortalBrowser.aspx.

When I click OK the AssetPortalBrowser.aspx page within the modal popup does not completely close. Instead the popup changes to a box with the following text:

"Please wait while your changes are processed."

and a title

"Processing...".

More specifically, I don't know where to write the code to close the form and return to the "dialogReturnValueCallback" function (just like it happens when the "Cancel" button gets clicked").

Please find below my code:

function InitiateAssetPickerPopUp(){

var context = new SP.ClientContext.get_current();
this.Web = context.get_web();
context.load(this.Web);
context.executeQueryAsync(Function.createDelegate(this, this.onSuccess),
    Function.createDelegate(this, this.onFail));
}

function onSuccess(sender, args){

var options = {
            title: 'My Dialog',
            width: 500,
            height:600,
            showClose: false,
            url: _spPageContextInfo.siteServerRelativeUrl+'/_layouts/AssetPortalBrowser.aspx?&AssetUrl='+_spPageContextInfo.siteServerRelativeUrl+'&RootFolder='+_spPageContextInfo.siteServerRelativeUrl+'&MDWeb='+this.Web.get_id()+'&AssetType=Link',
            dialogReturnValueCallback:function(dialogResult) 
            { 
              alert(dialogResult);
            }
  };  
  SP.UI.ModalDialog.showModalDialog(options);  
}

function onFail(sender, args) {
alert('Failed:' + args.get_message());
}
share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.