使用ASP.NET和SQL Server的元标记 [英] Meta Tag using asp.net and sql server
问题描述
大家好,
我有一个问题.
如何使用asp.net和C#后端SQL Server数据绑定meta标记中的值?
我希望使用meta标签动态地做到这一点.
请帮帮我.
谢谢和问候.
Nagarajan P.
Hi Guys,
I have one question.
How do I data bind the value in meta tag using asp.net and C# backend sql server?
I Expect to do it dynamically using meta tag.
Please help me.
Thanks and Regards.
Nagarajan P.
推荐答案
嗨
HtmlMeta des = new HtmlMeta();
des.Name = "description";
des.Content = Meta_Description;
Header.Controls.Add(des);
HtmlMeta来自名称空间System.Web.UI.HtmlControls
这个问题为您提供了答案.
http://www.codeproject.com/Questions/167720/Adding-meta-tag-dynamically-to-aspx-pages.aspx
HtmlMeta is from the namespace System.Web.UI.HtmlControls
This question has the answer for you.
http://www.codeproject.com/Questions/167720/Adding-meta-tag-dynamically-to-aspx-pages.aspx
HtmlHead head = this.Page.Header;
//--<meta name="title" content="your title" />
HtmlMeta meta= new HtmlMeta();
meta.Attributes.Add("name", "title");
meta.Attributes.Add("content","your title");
head.Controls.Add(meta);
//--<meta name="title" content="car,books,games" />
meta = new HtmlMeta();
meta.Attributes.Add("name", "keywords");
meta.Attributes.Add("content", "car,books,games");
head.Controls.Add(meta);
//--<meta name="description" content="your site description" />
meta = new HtmlMeta();
meta.Attributes.Add("name", "description");
meta.Attributes.Add("content","your site description");
head.Controls.Add(meta);
谢谢
互联网营销
Thanks
Internet Marketing
这篇关于使用ASP.NET和SQL Server的元标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!