How does master pages in aspnet2.0 do it?

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
 
B

Brock Allen

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" />
 
G

Guest

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!
***************************
 
G

Guest

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!
***************************
 
B

Brock Allen

In the earlier betas (have not played as deeply with the CTPs), the ~
was hit or miss with master pages.

It works properly with the 2004 Nov CTP. This better work in RTM, otherwise
it will be very difficult to reference resources from a master. :)
 
S

Showjumper

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 ~?
 
B

Brock Allen

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>
 

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

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top