2017-02-25 132 views
-1

我有aspx頁面像圖片: enter image description here如何添加圖標和頁面標題以一個asp.net頁面

我想要的favicon和頁面標題此頁面上。我在< head>標籤裏學到了這個:favicon和頁面標題。我嘗試了一些,但我沒有。我收到很多錯誤。 我該怎麼做(不要打擾代碼)有什麼想法嗎?

我添加上的.cs代碼:

protected void Page_Load(object sender, EventArgs e) 
{ 
    this.Title = "Title"; 
} 

//我得到這個錯誤:使用頁面的Title屬性要求頁頭控制。 (例如)

+1

@eagle請分享你的實際代碼,而不是一個屏幕截圖。 – JLRishe

回答

2

在你所示的代碼的情況下,你可以添加你需要的UxContentHead內容部分的任何head標籤:

<asp:Content ID="Content1" ContentPlaceHolderID="UxContentHead" runat="server"> 
     <!-- meta tags ... --> 
     <title>My Page Title</title> 
     <link rel="icon" 
      type="image/png" 
      href="http://example.com/myicon.png" /> 
     <link rel="shortcut icon" 
      type="image/png" 
      href="http://example.com/myicon.png"/> 
</asp:Content> 
+0

我添加了標題,但沒有改變。我有GlobalMaster.Master頁面,這個頁面包含以下標題: ' \t \t \t PM '和仍然認爲這個稱號‘PM’@JLRishe – eagle

+1

@eagle如果你的母版已經包含了一個標題,你需要爲了去除它能夠在特定的指定一個頁。 – JLRishe

+0

Yeap,非常感謝你@JLRishe – eagle

相關問題