2

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.

4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.