Reputation: 6541
Hey so currently I am placing meta tags such as :
<meta name="WT.oss_r" content="<%= SearchNumberOfResults%>"/>
I was thinking of putting this in a ASP:Panel
and setting visible to true
or false
depending on SearchNumberOfResults
being String.IsNullOrEmpty
but that puts div mark up in the <head>
section which is not ideal..
Whats a good way to hide and show meta tags ?
Upvotes: 0
Views: 559
Reputation: 1755
private string description;
page initialize:
HtmlMeta tag = new HtmlMeta();
tag.Name = "description";
tag.Content = description;
Header.Controls.Add(tag);
see this : Using-Meta-Tags-with-Master-Pages-in-ASP-NET
<%@ Page Language="C#" MetaKeywords="<%=SearchNumberOfResults%>" MetaDescription="This is my blog that focuses on ASP.NET." AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
protected void Page_Load(object sender, EventArgs e)
{
Page.MetaDescription = "sample meta description";
}
Upvotes: 1
Reputation: 3
add in your meta tag:
runat="server" id="xxx"
and in ASP.NET code
MyPanel.xxx.visible = false;
OR
xxx.visible = false;
I belive "panel" dont work in head section
Upvotes: 0