0
我已經動態地設置了頁面標題。當我查看頁面源代碼時,標籤出現兩次,一個標籤具有剛剛在開始下方動態設置的值,但另一個在之前是空白的。 在母版頁頭標記包含下面的代碼:頁<title></title>頁面上有兩次標籤錯誤頁面
<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);
}
我無法弄清楚,爲什麼標題中出現了兩次。 我也想把metakeyword,metadescription和標題放在標籤下面。
我已經試過這個,但是在關閉標籤前添加了
這種行爲很奇怪,對此有把握嗎? – 2012-03-20 10:38:51
是的,我得到了解決方案。只需在母版頁上添加默認的