473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Problem with an IMG from a Master Page

This seems like it should be so simple but I really can't figure out what's
going on:

I have a simple MasterPage. On that page I want to place an Image (IMG or
asp:Image, doesn't really matter to me). But for some reason, the image won't
come up because the path (src) for that image in the actual page displayed
isn't right. In the "src," I've tried using a path that starts with the "~"
(src="~/Shared/Images/xyz.jpg") and a path that is relative to the MasterPage
(src="../Images/xyz.jpg"). In both cases, I just don't get the right path at
output. The IMG tag is set as runat="server" and all that so I just can't
figure out what's going wrong here.

I'm starting to think that this has to do with the path of the actual page
displayed as opposed to the path from the MasterPage but that doesn't really
make a lot of sense either. Any thoughts?

Alex
May 12 '06 #1
3 1423
Alex Maghen wrote:
This seems like it should be so simple but I really can't figure out what's
going on:

I have a simple MasterPage. On that page I want to place an Image (IMG or
asp:Image, doesn't really matter to me). But for some reason, the image won't
come up because the path (src) for that image in the actual page displayed
isn't right. In the "src," I've tried using a path that starts with the "~"
(src="~/Shared/Images/xyz.jpg") and a path that is relative to the MasterPage
(src="../Images/xyz.jpg"). In both cases, I just don't get the right path at
output. The IMG tag is set as runat="server" and all that so I just can't
figure out what's going wrong here.

I'm starting to think that this has to do with the path of the actual page
displayed as opposed to the path from the MasterPage but that doesn't really
make a lot of sense either. Any thoughts?

Alex


Using ~ will bring you to the application root, so if you use an
asp:image with the image url set to "~/images/xxx.jpg" that should point
to application root/images/xxx.jpg.
May 12 '06 #2
> (IMG or asp:Image, doesn't really matter to me).

That's exactly the issue, an asp image control will handle virtual folders
having ~/...

"Ray Booysen" <rj***********@rjb.za.net> schreef in bericht
news:Oo****************@TK2MSFTNGP05.phx.gbl...
Alex Maghen wrote:
This seems like it should be so simple but I really can't figure out
what's going on:

I have a simple MasterPage. On that page I want to place an Image (IMG or
asp:Image, doesn't really matter to me). But for some reason, the image
won't come up because the path (src) for that image in the actual page
displayed isn't right. In the "src," I've tried using a path that starts
with the "~" (src="~/Shared/Images/xyz.jpg") and a path that is relative
to the MasterPage (src="../Images/xyz.jpg"). In both cases, I just don't
get the right path at output. The IMG tag is set as runat="server" and
all that so I just can't figure out what's going wrong here. I'm starting
to think that this has to do with the path of the actual page displayed
as opposed to the path from the MasterPage but that doesn't really make a
lot of sense either. Any thoughts?

Alex


Using ~ will bring you to the application root, so if you use an asp:image
with the image url set to "~/images/xxx.jpg" that should point to
application root/images/xxx.jpg.

May 14 '06 #3
Hi Alex,

Thank you for posting!

I've found a detailed article regarding how to reference images in master
pages:

#Master Pages: Master Your Site Design with Visual Inheritance and Page
Templates
http://msdn.microsoft.com/msdnmag/is...20MasterPages/

Search for the "Details of Usage" part.

Either using root path reference syntax or still using relative path, the
key is to use server-side controls.

Hope this helps.
Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 18 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Raphael Gluck | last post by:
Hi Everyone I am having some problems with a master detail page i have set up to catalogue brochures from my site. On my master page www.tripakltd.com/brochures.asp users are invited to select...
1
by: PCH | last post by:
Hello all, Been messing the the dec CTP of .net 2 Heres the situation: I have a master page with the contents control and a button control (call it btnRefresh). I have a child page that...
7
by: Martijn Saly | last post by:
Hi there, I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage...
0
by: Nick Stansbury | last post by:
I'm experiencing a weird problem with master pages in VS 2005 - in short when the master page is open in design view in visual studio all other webforms that use that master display correctly when...
1
by: yoknows | last post by:
Hello .Net Gurus. This is my first post here so I apologize in advance if I have not provided the right information. I hope someone has seen this problem before and can tell me what I am doing...
3
by: aldonnelley | last post by:
Hi all. Just having a weird problem with tkinter. I'm trying to make a gui that shows results from an image search, with a "forward" and "back" button so the user can compare results from...
2
by: Griff | last post by:
Hi I have a web page (content.aspx) that inherits from a master page (MasterPage.master). The master page has a control (which has to be on every web page, hence on the master page)...
5
by: LamSoft | last post by:
I've got some problem on some form submit problem. In a master page, there is a form tag with the "runat=server" attribute, and a ID called "myForm". In the contentPlaceHolder under that...
5
by: xlar54 | last post by:
I have a very simple 2.0 website (framework), that uses a master page...not. I added the default.aspx page as a webcontent form, with the master page as it's master page, but the master page is...
1
by: hemantkamb | last post by:
Hi…. I have created one website with Master and content page . I have taken TreeView Control on master page. And I wants that when I click to tree node the value of tree node is added to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.