2012-03-06 62 views
1

我無法設置我的ASP.NET頁面的標籤標題嵌套ASP.NET主頁中的標題

我有嵌套的母版頁。我可以成功設置標籤圖標,但標題始終顯示「主頁」。我究竟做錯了什麼?

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Topbar.master.cs" Inherits="WebApplication1.Masters.Topbar" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title>SomeTitle</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <link href="~/Styles/public.css" rel="stylesheet" type="text/css" />  
    <link rel="Shortcut Icon" href="~/Images/ionicon.ico" /> 

    <asp:ContentPlaceHolder ID="head" runat="server"> 
    </asp:ContentPlaceHolder> 

</head> 
<body> 

....

<%@ Master Language="C#" MasterPageFile="~/Masters/Topbar.Master" AutoEventWireup="true" 
    CodeBehind="Public.Master.cs" Inherits="WebApplication1.PublicMaster" %> 

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> 
    <asp:ContentPlaceHolder ID="head" runat="server"> 


    </asp:ContentPlaceHolder> 
</asp:Content> 

回答

8

在你應該使用@Page指令的內容頁面,在其中您可以設置頁面標題:

<%@ Page Language="C#" MasterPageFile="~/Master1.master" 
    AutoEventWireup="true" Title="Untitled Page" %> 
+0

啊!我看到我已經有了,設置爲「主頁」,它會覆蓋主標記。乾杯! :) – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/445533/">bretddog</a></span> <span>2012-03-06 10:35:31</span> </small> </span> </p> </div> </div> </div> </div> </div> </article> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1038284119" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <article class="board-top-1 padding-top-10"> <div class="post-col vote-info"> <span class="count">1<i class="fa fa-thumbs-up"></i></span> </div> <div class="post-offset"> <div class="answer fmt"> <p>你也可以通過在主頁面代碼文件中保留此塊,從服務器端執行此操作。</p> <pre><code class="prettyprint-override">string pageNM = Request.Url.ToString(); if (pageNM.Contains("index.aspx")) { this.Page.Title = "My custom Index Page Title"; } </code></pre> </div> <div class="post-info"> <div class="post-meta row"> <p class="text-secondary col-lg-6"> <span class="source"> <a rel="noopener" target="_blank" href="https://stackoverflow.com/q/9582178">來源</a> </span> </p> <p class="text-secondary col-lg-6"> <span class="float-right date"> <span>2012-03-06 10:51:16</span> </p> <p class="col-12"></p> <p class="col-12"></p></div> </div> </div> </article> </div> <div class="clearfix"> </div> <div class="relative-box"> <div class="relative">相關問題</div> <ul class="relative_list"> <li> 1. <a href="http://hk.uwenku.com/question/p-kgopwxjc-td.html" target="_blank" title="嵌套的主頁問題"> 嵌套的主頁問題 </a> </li> <li> 2. <a href="http://hk.uwenku.com/question/p-cyrzoohg-bdy.html" target="_blank" title="asp.net中的嵌套主頁面"> asp.net中的嵌套主頁面 </a> </li> <li> 3. <a href="http://hk.uwenku.com/question/p-qzmgsotp-nm.html" target="_blank" title="ASP.NET - 嵌套主頁中的FindControl"> ASP.NET - 嵌套主頁中的FindControl </a> </li> <li> 4. <a href="http://hk.uwenku.com/question/p-khtcklic-ht.html" target="_blank" title="ASP.NET MVC 1.0嵌套主頁面"> ASP.NET MVC 1.0嵌套主頁面 </a> </li> <li> 5. <a href="http://hk.uwenku.com/question/p-pbvwsloc-vt.html" target="_blank" title="asp.net中jquery的主頁動態標題"> asp.net中jquery的主頁動態標題 </a> </li> <li> 6. <a href="http://hk.uwenku.com/question/p-kngdvuvs-vn.html" target="_blank" title="Umbraco嵌套主頁"> Umbraco嵌套主頁 </a> </li> <li> 7. <a href="http://hk.uwenku.com/question/p-nhmzrrlh-yz.html" target="_blank" title="嵌套ASP.NET標籤"> 嵌套ASP.NET標籤 </a> </li> <li> 8. <a href="http://hk.uwenku.com/question/p-crpyumbp-nv.html" target="_blank" title="嵌套的主頁和.FindControl"> 嵌套的主頁和.FindControl </a> </li> <li> 9. <a href="http://hk.uwenku.com/question/p-gsjsqzik-bbh.html" target="_blank" title="ASP.NET中的嵌套主頁面導致控件丟失!"> ASP.NET中的嵌套主頁面導致控件丟失! </a> </li> <li> 10. <a href="http://hk.uwenku.com/question/p-mjucdhbc-xz.html" target="_blank" title="asp.net多個非嵌套的主頁在一個項目中"> asp.net多個非嵌套的主頁在一個項目中 </a> </li> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-6208739752673518" data-ad-slot="4606349252"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <li> 11. <a href="http://hk.uwenku.com/question/p-zaoajrzd-bmp.html" target="_blank" title="嵌套主頁和繼承"> 嵌套主頁和繼承 </a> </li> <li> 12. <a href="http://hk.uwenku.com/question/p-cpdykgdu-bma.html" target="_blank" title="ASP.NET嵌套主頁與CompilationMode =「Never」,一個recepie的災難? ASP.NET中的錯誤?"> ASP.NET嵌套主頁與CompilationMode =「Never」,一個recepie的災難? ASP.NET中的錯誤? </a> </li> <li> 13. <a href="http://hk.uwenku.com/question/p-aegfghfe-bdd.html" target="_blank" title="在asp.net中嵌入jQuery的主題"> 在asp.net中嵌入jQuery的主題 </a> </li> <li> 14. <a href="http://hk.uwenku.com/question/p-fkiqldxr-rk.html" target="_blank" title="標記中從嵌套主頁訪問控制"> 標記中從嵌套主頁訪問控制 </a> </li> <li> 15. <a href="http://hk.uwenku.com/question/p-netdqeej-bax.html" target="_blank" title="異步嵌套主題 - 範圍問題"> 異步嵌套主題 - 範圍問題 </a> </li> <li> 16. <a href="http://hk.uwenku.com/question/p-xflhwons-zr.html" target="_blank" title="查找嵌套主頁內的控件"> 查找嵌套主頁內的控件 </a> </li> <li> 17. <a href="http://hk.uwenku.com/question/p-oavmcgsc-dd.html" target="_blank" title="使用jQuery與嵌套的主頁"> 使用jQuery與嵌套的主頁 </a> </li> <li> 18. <a href="http://hk.uwenku.com/question/p-qgikintu-kg.html" target="_blank" title="嵌套的主頁和CSS文件"> 嵌套的主頁和CSS文件 </a> </li> <li> 19. <a href="http://hk.uwenku.com/question/p-mcwnjksh-uc.html" target="_blank" title="面板標題中的嵌套列"> 面板標題中的嵌套列 </a> </li> <li> 20. <a href="http://hk.uwenku.com/question/p-yzqlncte-hg.html" target="_blank" title="使用ASP.NET實現「反向」或「嵌套」主頁面"> 使用ASP.NET實現「反向」或「嵌套」主頁面 </a> </li> <li> 21. <a href="http://hk.uwenku.com/question/p-wxrsnfum-vn.html" target="_blank" title="asp.net頁面上的嵌套表單"> asp.net頁面上的嵌套表單 </a> </li> <li> 22. <a href="http://hk.uwenku.com/question/p-xcnfsxlm-oe.html" target="_blank" title="我如何引用主要主嵌套母版頁的場景在asp.net"> 我如何引用主要主嵌套母版頁的場景在asp.net </a> </li> <li> 23. <a href="http://hk.uwenku.com/question/p-gtlvaimk-zx.html" target="_blank" title="嵌套標籤欄問題"> 嵌套標籤欄問題 </a> </li> <li> 24. <a href="http://hk.uwenku.com/question/p-kruyehpk-yc.html" target="_blank" title="HTML標籤嵌套問題"> HTML標籤嵌套問題 </a> </li> <li> 25. <a href="http://hk.uwenku.com/question/p-ezvsqfxu-bcw.html" target="_blank" title="嵌套分組標題"> 嵌套分組標題 </a> </li> <li> 26. <a href="http://hk.uwenku.com/question/p-tyippxnm-rx.html" target="_blank" title="GWTP嵌套的標籤主持人"> GWTP嵌套的標籤主持人 </a> </li> <li> 27. <a href="http://hk.uwenku.com/question/p-xjhkxtht-bku.html" target="_blank" title="ASP.NET中的每頁一個CSS主題"> ASP.NET中的每頁一個CSS主題 </a> </li> <li> 28. <a href="http://hk.uwenku.com/question/p-zkwdybbl-cv.html" target="_blank" title="ASP.NET MVC中的主頁問題"> ASP.NET MVC中的主頁問題 </a> </li> <li> 29. <a href="http://hk.uwenku.com/question/p-gpjhcghu-n.html" target="_blank" title="問題與嵌套gridview的asp.net/C#"> 問題與嵌套gridview的asp.net/C# </a> </li> <li> 30. <a href="http://hk.uwenku.com/question/p-darsnmlf-st.html" target="_blank" title="WordPress主頁標題"> WordPress主頁標題 </a> </li> </ul> </div> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1575177025"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="padding-top-10"></div> </div> </div> <script type="text/javascript" src="http://img.uwenku.com/uwenku/script/side.js?t=1644592048261"></script> <script type="text/javascript" src="http://img.uwenku.com/uwenku/plugin/highlight/highlight.pack.js"></script> <link href="http://img.uwenku.com/uwenku/plugin/highlight/styles/docco.css" media="screen" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $('pre').each(function(i, e) { hljs.highlightBlock(e, "<span class='indent'> </span>", false) }); </script> <div class="col-lg-3 col-md-4 col-sm-5"> <div id="rightTop"> <div class="row"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="5415218910" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="row sidebar panel panel-default"> <div class="panel-heading font-bold"> 最新問題 </div> <div class="m-b-sm m-t-sm clearfix"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-wszjnyuy-d.html" target="_blank" title="標籤變量循環"> 標籤變量循環 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-qyjrkuqo-cc.html" target="_blank" title="是不是將屬性設置爲等於有效的HTML值?"> 是不是將屬性設置爲等於有效的HTML值? </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-rcmymcwv-bmd.html" target="_blank" title="如何實現全局密鑰監聽器?"> 如何實現全局密鑰監聽器? </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-oluxqrwc-bkr.html" target="_blank" title="Laravel 5廣播事件到通配符通道使用節點和Laravel ECHO-服務器"> Laravel 5廣播事件到通配符通道使用節點和Laravel ECHO-服務器 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-pwfrxlsb-bdt.html" target="_blank" title="選擇默認類型要下載"> 選擇默認類型要下載 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-ncdnnkbo-bep.html" target="_blank" title="如何使用正確的列名將文本分隔爲列"> 如何使用正確的列名將文本分隔爲列 </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-hctoaoej-beg.html" target="_blank" title="Inno Setup [設置] 64bit條件"> Inno Setup [設置] 64bit條件 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-mkycehfm-bgc.html" target="_blank" title="Linux上的Swift Objective-C互操作性錯誤:找不到'Foundation/Foundation.h'文件"> Linux上的Swift Objective-C互操作性錯誤:找不到'Foundation/Foundation.h'文件 </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-tlgbplif-bev.html" target="_blank" title="的SyntaxError 255李斯特"> 的SyntaxError 255李斯特 </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-ozjhreyu-bgs.html" target="_blank" title="如何在JAVA中使用apache POI在Excel中設置/取消設置列過濾器的值?"> 如何在JAVA中使用apache POI在Excel中設置/取消設置列過濾器的值? </a> </li> </ul> </div> </div> </div> <p class="article-nav-bar"></p> <div class="row sidebar article-nav"> <div class="row box_white visible-sm visible-md visible-lg margin-zero"> <div class="top"> <h3 class="title"><i class="glyphicon glyphicon-th-list"></i> 相關問題</h3> </div> <div class="article-relative-content"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-kgopwxjc-td.html" target="_blank" title="嵌套的主頁問題"> 嵌套的主頁問題 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-cyrzoohg-bdy.html" target="_blank" title="asp.net中的嵌套主頁面"> asp.net中的嵌套主頁面 </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-qzmgsotp-nm.html" target="_blank" title="ASP.NET - 嵌套主頁中的FindControl"> ASP.NET - 嵌套主頁中的FindControl </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-khtcklic-ht.html" target="_blank" title="ASP.NET MVC 1.0嵌套主頁面"> ASP.NET MVC 1.0嵌套主頁面 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-pbvwsloc-vt.html" target="_blank" title="asp.net中jquery的主頁動態標題"> asp.net中jquery的主頁動態標題 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-kngdvuvs-vn.html" target="_blank" title="Umbraco嵌套主頁"> Umbraco嵌套主頁 </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-nhmzrrlh-yz.html" target="_blank" title="嵌套ASP.NET標籤"> 嵌套ASP.NET標籤 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-crpyumbp-nv.html" target="_blank" title="嵌套的主頁和.FindControl"> 嵌套的主頁和.FindControl </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-gsjsqzik-bbh.html" target="_blank" title="ASP.NET中的嵌套主頁面導致控件丟失!"> ASP.NET中的嵌套主頁面導致控件丟失! </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-mjucdhbc-xz.html" target="_blank" title="asp.net多個非嵌套的主頁在一個項目中"> asp.net多個非嵌套的主頁在一個項目中 </a> </li> </ul> </div> </div> </div> </div> </div> </div> </div><!-- wrap end--> <!-- footer --> <footer id="footer"> <div class="bg-simple lt"> <div class="container"> <div class="row padder-v m-t"> <div class="col-xs-8"> <ul class="list-inline"> <li><a href="http://hk.uwenku.com/contact">聯系我們</a></li> <li>© 2020 HK.UWENKU.COM</li> <li><a target="_blank" href="https://beian.miit.gov.cn/">沪ICP备13005482号-4</a></li> <li><script type="text/javascript" src="https://v1.cnzz.com/z_stat.php?id=1280101193&web_id=1280101193"></script></li> <li><a href="http://www.uwenku.com/" target="_blank" title="优文库">简体中文</a></li> <li><a href="http://hk.uwenku.com/" target="_blank" title="優文庫">繁體中文</a></li> <li><a href="http://ru.uwenku.com/" target="_blank" title="поле вопросов и ответов">Русский</a></li> <li><a href="http://de.uwenku.com/" target="_blank" title="Frage - und - antwort - Park">Deutsch</a></li> <li><a href="http://es.uwenku.com/" target="_blank" title="Preguntas y respuestas">Español</a></li> <li><a href="http://hi.uwenku.com/" target="_blank" title="कार्यक्रम प्रश्न और उत्तर पार्क">हिन्दी</a></li> <li><a href="http://it.uwenku.com/" target="_blank" title="IL Programma di chiedere Park">Italiano</a></li> <li><a href="http://ja.uwenku.com/" target="_blank" title="プログラム問答園区">日本語</a></li> <li><a href="http://ko.uwenku.com/" target="_blank" title="프로그램 문답 단지">한국어</a></li> <li><a href="http://pl.uwenku.com/" target="_blank" title="program o park">Polski</a></li> <li><a href="http://tr.uwenku.com/" target="_blank" title="Program soru ve cevap parkı">Türkçe</a></li> <li><a href="http://vi.uwenku.com/" target="_blank" title="Đáp ứng viên">Tiếng Việt</a></li> <li><a href="http://fr.uwenku.com/" target="_blank" title="Programme interrogation Park">Française</a></li> </ul> </div> </div> </div> </div> </div> </footer> <!-- / footer --> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?f78a970f17b19a79fc477a3378096f29"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </body> </html>