0

I have following code

builder.AppendFormat("<img style='border:0; left:-0px !important;position:absolute;' id='AddQuickTagImg_{0}' alt=\"{1}\" src='<% $SPUrl:~sitecollection/Style Library/Images/MyImage_32.png %>'/></span>", this.ClientID, likeTooltip);   

The problem i have is following thing:

 <% $SPUrl:~sitecollection/Style Library/Images/MyImage_32.png %>

Specifying this in this way, doesn't return me the correct image :( How can i solve this?

~sitecollection means root site collection? or it is just closest site collection? Imagine nested site collections, which site collection it will be outer of inner?

Thanks

0

You should get the URL using SPContext.Current.Site.Url:

var siteCollUrl = SPContext.Current.Site.Url;
builder.AppendFormat("<img style='border:0; left:-0px !important;position:absolute;' id='AddQuickTagImg_{0}' alt=\"{1}\" src='{2}'/></span>", this.ClientID, likeTooltip, siteCollUrl); 

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.