ASP.Net - Dynamically Adding a CSS/StyleSheet Reference at run-time
Per Michael, I have removed a technique that was only available in Beta 1.
protected void Page_Init(object sender, EventArgs e) { HtmlLink link = new HtmlLink(); link.Href = "~/StyleSheet.css"; link.Attributes.Add("rel", "stylesheet"); link.Attributes.Add("type", "text/css"); Page.Header.Controls.Add(link); }
3 comments:
The blog is helpfull...
visit also asp.net example
LinkedStyleSheets was available only in Beta (see http://forums.asp.net/p/878854/901772.aspx#901772), so the first method is WRONG.
Gratteful for sharing this
Post a Comment