给页面添加关键词和简介

               

1.取出数据,即可存储在XML文档中

       DataTable dt = DBHelper.GetDataSet("select * from SEO where id=1");

2.创建实例
                HtmlMeta metaKeyWords = new HtmlMeta();

3.定义名称
       metaKeyWords.Name = "Keywords";

4.定义内容
                metaKeyWords.Content = Convert.ToString(dt.Rows[0]["keyword"]);

5.添加到页面
       this.Page.Header.Controls.Add(metaKeyWords);


                HtmlMeta metaDescription = new HtmlMeta();
                metaDescription.Name = "description";
                metaDescription.Content = Convert.ToString(dt.Rows[0]["description"]);
      this.Page.Header.Controls.Add(metaDescription);

posted @ 2012-02-10 15:23  Xyang  阅读(185)  评论(0编辑  收藏  举报
hi