Login    
 
 
 
 
Text/HTML
  
You are here :: Blogs Saturday, May 19, 2012

Search
Note: This uses the internal blog search engine. The Google search engine is also available at the top of the page.
  
Disclaimer

Please review the site disclaimer before downloading or using content found on this site

  
Categories
  
DEVSHED Blog
As always, I welcome your comments!
Mar 10

Written by: Steve Gray
3/10/2011 6:54 PM  RssIcon

Earlier I discussed how to dynamically link to background images in ASP.NET. This is a little different, and requires a little different technique. 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:

Code Snippet
  1. <link rel="stylesheet" id="blackicetheme" type="text/css" runat="server" />

The key is the 'id'

Now put this code in the 'on load' event:

Code Snippet
  1. blackicetheme.Attributes("href") = ResolveUrl("~/themes/20101/blackice/theme.css")

That'll fix the problem.

Tags:
Categories:
As always, I welcome your comments!
  
 
 
Home | Products | Blogs | Contact Us | Links | God's Plan
Privacy Statement | Terms Of Use
 
Copyright 2011 by Devshed.us