【发布时间】:2012-03-20 10:30:13
【问题描述】:
我已动态设置页面标题。当我查看<title> 标记出现两次的页面源时,一个标记具有我在<head> 开始下方动态设置的值,但另一个在</head> 之前是空白的。
在母版页头标签中包含以下代码:
<head runat="server">
<asp:ContentPlaceHolder ID="pageTitle" runat="server"></asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
在页面上我已将页面标题设置为:
var title = new HtmlTitle {Text = title1};
var h1Tag = Utilities.FindControlRecursive(this, "pageTitle");// by the find the pageTitle control
if (h1Tag != null)
{
h1Tag.Controls.Add(title);
}
我无法弄清楚为什么标题出现两次。
我还想把元关键字、元描述和标题放在<head> 标签的下面。
【问题讨论】:
标签: c# asp.net master-pages