472,119 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Master Page background image only visible from pages in root directory

I hope I can explain this well enough to understand. I have a master page
that is used by almost all of the pages in my site. On the master page is a
table. In one of the cells in this table, I have set the background to
display an image that is located in a directory called "images" which is
just off the root directory. Here's the problem:

Any page that is not located in the root directory (where the master page is
located) cannot see the background image. Pages that ARE located in the
root directory can. I have tried using "~/images/filename.jpg" for the
background source but this didn't work. In fact, the only that has worked
so far is to put the full URL ("http://www.mysite.com/images/filename.jpg")
for the background source. I'm still relatively new to ASP.NET 2.0 and I
don't know what (if any) problems using the full URL might cause.

Can anyone suggest a solution (or is using the full URL for this the correct
way to go).

Thanks!
May 24 '06 #1
2 3244
thing of MasterPages like the includes in classic asp...

if you have your master.page in your root folder all the children must be in
the root...

so, the best practce is like this:

root
|--- images
|--- includes
|--- |--- css
|--- |--- js
|--- aspx
web.config
site.map

aspx folder could be several, like
|--- admin
|--- user
|--- master <--- add all the master pages in your website here 4 example
|--- profile
...

it's a clean way to build your website, I always start by the folders, and
then I start workin' in Master.Page and then the content pages.

inside aspx folder (or others) you put all your content pages and the
master page, and for all images all you need to do is:

"../images/...jpg" <-- so get back one folder (you'll be in root) and go to
images folder

if you follow my example, you wwill not having any problem with image links
and you'll have a nice and clean enviroment for your website.

by the way... the best way to have background images is in CSS!
--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"news.sbcglobal.net" <gr************@MAPSONsbcglobal.net> escreveu na
mensagem news:cb******************@newssvr29.news.prodigy.n et...
I hope I can explain this well enough to understand. I have a master page
that is used by almost all of the pages in my site. On the master page is
a table. In one of the cells in this table, I have set the background to
display an image that is located in a directory called "images" which is
just off the root directory. Here's the problem:

Any page that is not located in the root directory (where the master page
is located) cannot see the background image. Pages that ARE located in
the root directory can. I have tried using "~/images/filename.jpg" for
the background source but this didn't work. In fact, the only that has
worked so far is to put the full URL
("http://www.mysite.com/images/filename.jpg") for the background source.
I'm still relatively new to ASP.NET 2.0 and I don't know what (if any)
problems using the full URL might cause.

Can anyone suggest a solution (or is using the full URL for this the
correct way to go).

Thanks!

May 24 '06 #2
"Bruno Alexandre" <br*********@gmail.com> wrote in message
news:uW**************@TK2MSFTNGP05.phx.gbl...
it's a clean way to build your website, I always start by the folders, and
then I start workin' in Master.Page and then the content pages.


Me too.
May 24 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Nalaka | last post: by
2 posts views Thread by Samuel Shulman | last post: by
4 posts views Thread by JimHeavey | last post: by
7 posts views Thread by TheLongshot | last post: by
16 posts views Thread by IfThenElse | last post: by
8 posts views Thread by Cirene | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.