meta tags dynamically

D

Dariusz Tomon

Hello

How can I build meta tags dynamically? Please provide an example.

Thank you

Dariusz Tomon
 
E

Eliyahu Goldin

If you are with 2.0, look at the class HtmlMeta. Here is the example from
the msdn:

protected void Page_Load(object sender, EventArgs e)
{
// Create two instances of an HtmlMeta control.
HtmlMeta hm1 = new HtmlMeta();
HtmlMeta hm2 = new HtmlMeta();

// Get a reference to the page header element.
HtmlHead head = (HtmlHead)Page.Header;

// Define an HTML <meta> element that is useful for search engines.
hm1.Name = "keywords";
hm1.Content = "words that describe your web page";
head.Controls.Add(hm1);

// Define an HTML <meta> element with a Scheme attribute.
hm2.Name = "date";
hm2.Content = DateTime.Now.ToString("yyyy-MM-dd");
hm2.Scheme = "YYYY-MM-DD";
head.Controls.Add(hm2);

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top