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.

0

1 Answer 1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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