How to render asp image tags in masterpage/page layout?
In my .html page layout file, I have this code

    <!--<asp:Image runat="server" imageurl="<% $SPUrl:~sitecollection/Style Library/en-us/help.gif %>" alternatetext="More information" />-->

And then in the rendered client side result, if I view the source of the page, it looks like

    <!--<img src="/Style%20Library/en-us/help.gif" alt="More information" />-->

and the comments prevent it from being parsed into an image. How can I fix this?

Thanks
July 30th, 2015 9:54am

Hi,

since the comments are the HTML-specific comments, the content of the aspx will be computed on the serverside anyway. That's why you see the image Tag on the client side with the computed URL. The comment-Tag is only interpreted on the clientside which means, that the image-Tag is not present in the UI.

If you want it to be shown, simply remove "<!--" from before the control and "-->" after it.

Kind regards!

Peter

Free Windows Admin Tool Kit Click here and download it now
July 30th, 2015 10:31am

I tried but it crashes because for SP2013 html pages, controls need comments around it.
July 30th, 2015 10:44am

Hi

enclose it in <!--MS:--> and <!--ME:--> tag when adding any control to html page while using with Sharepoint Design manager.

<!--MS: <asp:Image runat="server" imageurl="<% $SPUrl:~sitecollection/Style Library/en-us/help.gif %>" alternatetext="More information">--> 

<!--ME:</asp:Image>--> 
Hope this help.

Free Windows Admin Tool Kit Click here and download it now
July 31st, 2015 1:36am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics