I don't know a whole lot about metatags, but I do know that the Add method
is used for appending to a collection, not replacing individual items. What
you basically need to do if you want to replace the metatags is one of the
following:
1. Don't include any metatags in the master page itself, and add all of them
dynamically in the content pages
2. Call the Header.Controls.Clear() method before dynamically adding the
metatags in the content page
3. In the master page's metatags include id and runat="server" attributes so
that you can remove them before adding another metatag in the content page
Note that when using the first two options you will need to add ALL metatags
in the content page. Hopefully this helps.
--
Nathan Sokalski
nj********@hotmail.com http://www.nathansokalski.com/
"Sinan Alkan" <DL@DL.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
In a master page --content page system, is it possible to change the
"description" and "keywords" meta tags of the master page from content
page ?
I am trying as follows, from content page....
protected void Page_Load(object sender, EventArgs e)
{
HtmlMeta fordesc = new HtmlMeta();
fordesc.Name = "keywords";
fordesc.Content = "word1, word2, word3";
Header.Controls.Add(fordesc);
}
But it adds second "keywords" metatag sentence to the page .
How can i just replace or change tags of the master-pages's ?
Thanks in advance...
PS: I'm using c# and framework 2.0