View Single Post
  #4 (permalink)  
Old May 30th, 2012, 05:16 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi there,

That wouldn't work. With that code, the CSS in the head control gets overwritten with custom content from content pages that have a Content control for the head ContentPlaceholder.

But my solution wouldn't work either. I was hoping you could embed a ContentPlaceHolder in a meta tag like this:

<meta name="keywords" content='<asp:ContentPlaceHolder id="keywords" runat="server" />' />

Obviously, that doesn't make any sense as the CPH would just be seen as literal content. Not sure why I thought that would work. Must be the warm weather here ;-)

So, I guess your best solution is to use the head CPH as it's added by default to the master page and add the meta tags for each content page to that control.

Hope this helps, and sorry for sending you in the wrong direction.


Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote