Adding a CSS Link from the code behind in ASP.NET C#

Below is the code that will allow you to add a CSS Link from the code behind:

private void addCSS()        

{           
// CREATE CSS LINK           
HtmlHead head = (HtmlHead)Page.Header;           
HtmlLink link = new HtmlLink();           
link.Attributes.Add("href", Page.ResolveClientUrl("~/Styles/Clients/Site.css"));           
link.Attributes.Add("type", "text/css");           
link.Attributes.Add("rel", "stylesheet");           
head.Controls.Add(link);       
}

 

Comments

Marty @ 10/09/2011 07:51:11
To think, I was consfeud a minute ago.
moblhws @ 11/09/2011 13:43:19
Dy01uf , [url=http://xfzkqkefddak.com/]xfzkqkefddak[/url], [link=http://mndppoxgjinz.com/]mndppoxgjinz[/link], http://kgyybnjvwvnn.com/
rwqhqy @ 13/09/2011 13:47:17
Cp8qkc , [url=http://vxvtkhsgvmmf.com/]vxvtkhsgvmmf[/url], [link=http://emcxfnlmgmcc.com/]emcxfnlmgmcc[/link], http://epyjwwtoayeg.com/
@ 18/10/2011 05:10:15

Add a comment...

Name
Email Address
Comment