How does master pages in aspnet2.0 do it?

  • Thread starter Thread starter Showjumper
  • Start date Start date
S

Showjumper

In asp.net 2.0, when using master pages the paths to images, styles sheets
etc get fixed appropriately depeing on whether the child page is in a
subfolder or not. How does master pages do it? Cani implement htis somehow
in 1.1? I have been playing with the templating solution present in the
aspnet insider tricks.Migh it be possible to add the behavior to that
approach somehow?

Thanks
Ashok
 
The relative paths in ASP.NET 2.0 are the same as ASP.NET 1.1 -- anytime
you have a server side control that has a server side resource, use the "~"
syntax to build a relative path to the resource.

<asp:Image runat=server ImageUrl="~/images/foo.gif" />

-Brock
http://staff.develop.com/ballen
 
In the earlier betas (have not played as deeply with the CTPs), the ~ was hit
or miss with master pages.


---

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

***************************
Think Outside the Box!
***************************
 
There are a few people that have "reverse engineered" the idea and put it in
their software. I believe Dot Net Nuke is one of the projects that has done
this.


---

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

***************************
Think Outside the Box!
***************************
 
This approach however doesnt work stylesheets even when giving the runat
attr. to the <link> tag. Would an option be to make a custom control that
emits the <link> tag? Would it then handle the ~?
 
This approach however doesnt work stylesheets even when giving the
runat
attr. to the <link> tag. Would an option be to make a custom control
that
emits the <link> tag? Would it then handle the ~?

I'm running the 2004 Nov CTP and this works for me:

<head runat="server">
<link rel="stylesheet" href="~/CSS/Stylesheet.css" type="text/css" />
</head>

-Brock
http://staff.develop.com/ballen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top