Master Page Images

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If on my master page I have an image which is in the image folder. For web
pages which are in the "default" directory, the image displays just fine.
But if one of my pages which "utilizes" the master page is in a folder called
"Fred", the image is not resolved. If I change the reference to the "src" to
"../image", then the image is resolved just fine on the web page which is in
the "Fred" directory, but does not resolve the location correctly for all of
the other web pages which are no in sub directories.

Do I have to change this location in code each time or is there another more
pratical solution?

Thanks in advance for your assistance!!!
 
<asp:Image ID="blah" runat="server" src="~/images/myimage.gif" />

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
 
You will no doubt have problems with scripts and stylesheet files too.

<link href="<%= ResolveClientUrl("stylesheet.css") %>" rel="Stylesheet"
/>

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
 
Use a control and then use the tilde instead of ..

asp:Image is a good choice, jsut set the url with a ~ at the beginning to
indicate virtual root.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside the box!
*************************************************
 
Back
Top