DynDeveloper.com

DynDeveloper.com

Sign Up Now! Log In
steve gray 8/6/2011 2:28:49 PM

Dynamic Style Sheet Links in ASP.NET

Earlier I discussed how to dynamically link to background images in ASP.NET. This is a little different, and repuires a little different techniqe. The issue is that when a master page serves a page in a subdirectory, it can't find the style sheet. Not a problem, really, except for the way that ASP.NET 2.0 development works. In development, the site runs as a virtual site, and the path to the css is different in development than when published.

This code will fix that.

Create the css links in the header section of the master page like this:
Version: Unknown or N/A
Section: Off Topic