Master Pages and CSS StyleSheets
A common problem that often arises from using Master Pages is the confusion about how to reference a CSS StyleSheet from a page within a Master Page. The problem is that the <head> section of the markup is located in the Master Page, so the reference to the StyleSheet cannot be made… seemingly. The trick is to add some code to the Page Load event of the page that need access to the StyleSheet.
This little snippet of code comes in handy during these situations:
Dim link As New HtmlLink
link.Href = “LocationOfMyStyleSheet.css”
link.Attributes.Add(HtmlTextWriterAttribute.Rel.ToString(), “stylesheet”)
Page.Header.Controls.Add(link)