ASP2.0中的HtmlHeader的一些使用方法

1. 修改标题:
this.Header.Title = "This is the new page title.";

2. 添加CSS样式:
Style style = new Style();
style.ForeColor = System.Drawing.Color.Navy;
style.BackColor = System.Drawing.Color.LightGray;
this.Header.StyleSheet.CreateStyleRule(style, null, "body");

3. 链接外部的CSS样式表:
HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("href", "~/newstyle.css");
this.Header.Controls.Add(link);

你可能感兴趣的:(header)