TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Microsoft > Microsoft Expression > Microsoft Expression Web Designer

Notices

Reply
 
Thread Tools Display Modes
Old 20-06-2008, 02:50 PM   #11
Chris Smith
Guest
 
Posts: n/a
Master pages, images and subdirectories

Hi, I've had a similar problem so need to confirm the solutions

Firstly I don't want to use asp image server controls but keep html where possible

If I use <img src="/images/pic.jpg" /> then this would works for all subdirectories but doesn't work in design view of Expression Web 2.0 if the master is not in the root. Is there a way to resolve this?

Using ~ such as <img src="~/images/pic.jpg" /> only works in ASP.NET coontrols, is that correct?

Using relative paths such as <img src="../images/pic.jpg" /> doesn't work as the page is not updated from the master

tia, Chris
  Reply With Quote
Old 20-06-2008, 04:49 PM   #12
Christoph Schneegans
Guest
 
Posts: n/a
Re: Master pages, images and subdirectories

Chris Smith wrote:

> If I use <img src="/images/pic.jpg" /> then this would works for
> all subdirectories but doesn't work in design view of Expression
> Web 2.0 if the master is not in the root.


xWeb does not support root-relative paths such as "/foo" or
"/foo/bar". You should avoid using them.

> Using ~ such as <img src="~/images/pic.jpg" /> only works in
> ASP.NET coontrols, is that correct?


Yes. But you just need to add runat="server" to your "img" element.

> Using relative paths such as <img src="../images/pic.jpg" />
> doesn't work as the page is not updated from the master


Yes, there is no URL rewriting in Master Pages. Dynamic Web
Templates work better in this aspect.

--
<http://schneegans.de/sv/> · XML Schema Validator

  Reply With Quote
Old 20-06-2008, 08:00 PM   #13
Cowboy \(Gregory A. Beamer\)
Guest
 
Posts: n/a
Re: Master pages, images and subdirectories

If you are going to use ASP.NET, I would go ahead and bite the bullet and
use the <asp:Image> control, so you can use the tilde (~) to represent root.
I understand trying to keep things as HTML, but the overhead of adding a few
controls is negligible unless your site is a google. And, if your site is a
google, you have the money to solve this success problem.

To render an image from a control wastes a few microseconds at best compared
to standard html. The time to request and download the image far outweighs
the cost, in cycles. In addition, the network latency will offset the cost
of all other portions combined. As long as you are not using thousands,
perhaps millions, of images on a master page (unlikely), I would not sweat
this one.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

********************************************
| Think outside the box! |
********************************************
"Chris Smith" wrote in message
news:200862034835csmith@oilspilltraining.com...
> Hi, I've had a similar problem so need to confirm the solutions
>
> Firstly I don't want to use asp image server controls but keep html where
> possible
>
> If I use <img src="/images/pic.jpg" /> then this would works for all
> subdirectories but doesn't work in design view of Expression Web 2.0 if
> the master is not in the root. Is there a way to resolve this?
>
> Using ~ such as <img src="~/images/pic.jpg" /> only works in ASP.NET
> coontrols, is that correct?
>
> Using relative paths such as <img src="../images/pic.jpg" /> doesn't work
> as the page is not updated from the master
>
> tia, Chris


  Reply With Quote
Old 20-06-2008, 08:56 PM   #14
Cowboy \(Gregory A. Beamer\)
Guest
 
Posts: n/a
Re: Master pages, images and subdirectories

INLINE


"Christoph Schneegans" <Christoph@Schneegans.de> wrote in message
news:6c1c5lF3dul5iU1@mid.individual.net...
> Chris Smith wrote:
>
>> Using ~ such as <img src="~/images/pic.jpg" /> only works in
>> ASP.NET coontrols, is that correct?

>
> Yes. But you just need to add runat="server" to your "img" element.


As long as it is understood that simply adding runat=server to an HTML
control does not add the relative url mapping. The routine to find the
server path for root is not included in the html controls.

>> Using relative paths such as <img src="../images/pic.jpg" />
>> doesn't work as the page is not updated from the master

>
> Yes, there is no URL rewriting in Master Pages. Dynamic Web
> Templates work better in this aspect.


The con with DWTs is they do get out of sync and fail to update pages. If
the page is not updated, you end up with the old look.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

********************************************
| Think outside the box! |
********************************************

  Reply With Quote
Old 20-06-2008, 10:08 PM   #15
Mark Fitzpatrick
Guest
 
Posts: n/a
Re: Master pages, images and subdirectories

Chris, add the runat="server" attribute to the image tag and this will turn
it into an HtmlImage control. The src="~/images/pic.jpg" format is what you
want. Give it a quick try and it should work.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Chris Smith" wrote in message
news:200862034835csmith@oilspilltraining.com...
> Hi, I've had a similar problem so need to confirm the solutions
>
> Firstly I don't want to use asp image server controls but keep html where
> possible
>
> If I use <img src="/images/pic.jpg" /> then this would works for all
> subdirectories but doesn't work in design view of Expression Web 2.0 if
> the master is not in the root. Is there a way to resolve this?
>
> Using ~ such as <img src="~/images/pic.jpg" /> only works in ASP.NET
> coontrols, is that correct?
>
> Using relative paths such as <img src="../images/pic.jpg" /> doesn't work
> as the page is not updated from the master
>
> tia, Chris


  Reply With Quote
Old 21-06-2008, 01:02 AM   #16
Christoph Schneegans
Guest
 
Posts: n/a
Re: Master pages, images and subdirectories

"Cowboy (Gregory A. Beamer)" wrote:

> As long as it is understood that simply adding runat=server to an HTML
> control does not add the relative url mapping. The routine to find the
> server path for root is not included in the html controls.


<img src="~/foo/bar.jpg" runat="server" />

works for me. The "src" attribute gets properly resolved e.g. to
"../foo/bar.jpg" by ASP.NET.

--
<http://schneegans.de/sv/> · XML Schema Validator

  Reply With Quote
Reply

Thread Tools
Display Modes


Google
 


All times are GMT +5.5. The time now is 02:13 AM.


vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2008, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional