Question

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.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top