asp.net中如何动态修改母版页的title

protected void Page_Load(object sender, EventArgs e)
{
  //修改head标签中的title标签属性
  Page.Header.Title = "编程改变内容页标题";
  //修改head标签包含的其它标签属性,间接修改了页面背景颜色
  Style myStyle = new Style();
  myStyle.BackColor = System.Drawing.Color.Red;
  Page.Header.StyleSheet.CreateStyleRule(myStyle, null, "html");
  //添加新标签meta到head标签中
  HtmlMeta metaKeywords = new HtmlMeta();
  metaKeywords.Name = "KEYWORDS";
  metaKeywords.Content = "asp.net,c#";
  HtmlHead head = Page.Header;
  head.Controls.Add(metaKeywords);
}

 

posted @ 2014-08-18 16:17  linyongqin  阅读(220)  评论(0编辑  收藏  举报