malaikuangren

What is the purpose or drive to build thing like (xxx),How can it achieve the original goal of design?
Add a stylesheet link programmatically in ASP.NET

Here’s a code snippet used to programmatically insert a stylesheet link to an external CSS file:

// Create the <link> element for the CSS file
var stylesheet = new HtmlLink { Href = "/path/to/stylesheet.css" };
stylesheet.Attributes.Add("rel","stylesheet");
stylesheet.Attributes.Add("type","text/css");
 
// Add it to the <head> element of the page
Page.Header.Controls.Add(stylesheet);

  

posted on 2013-07-31 23:36  malaikuangren  阅读(248)  评论(0编辑  收藏  举报