读取写入meta标签属性

2019-05-14 17:10    浏览:512次

读取
1. this.Page.Header.FindControl("meta控件ID") as HtmlMeta

2. Master.Page.Header.FindControl("meta控件ID") as HtmlMeta

 

写入
HtmlMeta keywords = new HtmlMeta();
HtmlMeta description = new HtmlMeta();
keywords.Name = "keywords";
description.Name = "description";
keywords.Content = txtkeywords.Text.Trim();
description.Content = txtdis.Value.Trim();
this.Page.Header.Controls.Add(keywords);
this.Page.Header.Controls.Add(description);