有时需要打开SharePoint应用程序页面作为弹出窗口。那么如何使用C#打开SP应用程序页面作为弹出窗口?
答案 0 :(得分:0)
C#代码:
void OpenApplicationPageAsPopup(){
string strWebUrl = SPContext.Current.Web.Url;
string strPageURL = strWebUrl + "/_layouts/MyLayoutFolder/MyPage.aspx";
System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), ClientID, "ExecuteOrDelayUntilScriptLoaded(openModelDialogPopup('" + strPageURL + "'), \"SP.js\");", true);
}
JavaScript代码:
function openModelDialogPopup(strPageURL ) {
var dialogOptions = {
title: "This is Modal Dialog", //Popup title.
url: strPageURL,
width: 600, // Width of the dialog.
height: 400
};
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', dialogOptions);
return false;
}