in Page.aspx:
<head runat="server" id="header">
<title>Untitled Page</title>
</head>
// codebehind:
protected void Page_Load(object sender, EventArgs e)
{
HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("href", "~/styles/main.css");
this.header.Controls.Add(link);
}
--
Site:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
Short urls & more:
http://ittyurl.net
"Ron James" wrote:
How can I add the following element to the <Headsection of every page?
<link href="Styles/main.css" type="text/css" rel="stylesheet">
I would like to do this in my Page base class (in the overridden Render
method perhaps?) rather than adding the tag to each page.
Or is there a better way of applying this css to every page.
Thanks