meta name DESCRIPTION dynamically

D

Dariusz Tomon

Hello

How can I build meta name DESCRIPTION dynamically?
I need an example.

Best Regards

Dariusz Tomon
 
M

Mark Fitzpatrick

Usually what I would do for these items is to create them in the page by
adding the runat attrribute so

<meta name="description" id="metaDescription" runat="server">

In code you can reference it as a type HtmlGenericControl like so

define it as:
protected HtmlGenericControl metaDescription;

and then you can add whatever attributes you want like so:

metaDescription.Attributes.Add("content","This would be a description of my
page");
 
M

Mark Fitzpatrick

It should work in either 1.1 or 2.0 as I don't think the HtmlGenericControl
has changed between versions.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top