문제

I would like to open a New Item Form inside a Dialog. For this approach I'm using the following code:

<script type="text/javascript">
string SiteUrl = SPContext.Current.Site.Url
 function displayLayover(url) {

 var options = SP.UI.$create_DialogOptions();

 options.url = url;

 options.dialogReturnValueCallback = Function.createDelegate(

 null, null);

 SP.UI.ModalDialog.showModalDialog(options);
 }
 </script>

It works totally fine but now I would like to get the link of the current subsite, because the goal is to save the subsite as template and don't change the script manually inside the Script Editor.

도움이 되었습니까?

해결책

I think you need to put url instead SiteUrl it will be like this : string url = SPContext.Current.Site.Url; however this code will not run try to use page variable _spPageContextInfo : string url = _spPageContextInfo.siteAbsoluteUrl;

Note : If you use SPContext in Client Object Model code it would be null.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top