Wednesday, September 21, 2011

Resolve problem in Master Pages Image Path

Hi all in ASP.net Master pages some time behave like weird. Because I have create some pages and put into a folder  and there is separate folder to images but when it is loaded imagers doesn’t load in some pages. I have tried using both ways  “../../images/logo.jpg” and “~/images/logo.jpg”  but I couldn’t make it happen finally I search it in the “Google”
same problem appear in the following link
http://channel9.msdn.com/Forums/TechOff/250382-Absolute-Image-Locations-and-Master-Pages

solution for that is inset the following code inside the “img” tag 


<%=Page.ResolveURL("~/Images/logo.jpg")%>
eg:
<img src="<%= Page.ResolveUrl("~/images/ihtrustlogo_colour.gif")%>" />

Then my task is done perfectly

0 comments:

Post a Comment