WebPart.TitleUrl 屬性

定義

取得或設定至 WebPart 控制項之補充資訊的 URL。

public:
 virtual property System::String ^ TitleUrl { System::String ^ get(); void set(System::String ^ value); };
[System.Web.UI.Themeable(false)]
[System.Web.UI.WebControls.WebParts.Personalizable(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared)]
public virtual string TitleUrl { get; set; }
[<System.Web.UI.Themeable(false)>]
[<System.Web.UI.WebControls.WebParts.Personalizable(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared)>]
member this.TitleUrl : string with get, set
Public Overridable Property TitleUrl As String

屬性值

String

字串,表示至 WebPart 控制項之詳細資訊的 URL。 預設值為空字串 ("")。

實作

屬性

例外狀況

內部驗證系統判斷此 URL 可能包含指令碼攻擊。

範例

下列程式碼範例示範如何設定 TitleUrl 自訂Web 組件控制項的 屬性。 本範例假設使用類別概觀的範例區段中 WebPart 所找到的自訂控制項 TextDisplayWebPart

請注意,元素 <aspSample:TextDisplayWebPart> 包含 TitleUrl 具有虛構 URL 的屬性。 如果您在瀏覽器中載入頁面,控制項的 WebPart 標題現在是 屬性所指向 TitleUrl 之資源的連結。

<%@ page language="C#" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.CS.Controls" 
             Assembly="TextDisplayWebPartCS"%>

<!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 id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
      <asp:webpartmanager id="WebPartManager1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      title="Zone 1"
      PartChromeType="TitleAndBorder">
        <parttitlestyle font-bold="true" ForeColor="#3300cc" />
        <partstyle
          borderwidth="1px"   
          borderstyle="Solid"  
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text Content WebPart" 
            TitleUrl="HelpFile.htm"
            />
          </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>
<%@ page language="VB" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.VB.Controls" 
             Assembly="TextDisplayWebPartVB"%>

<!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 id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
      <asp:webpartmanager id="WebPartManager1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      title="Zone 1"
      PartChromeType="TitleAndBorder">
        <parttitlestyle font-bold="true" ForeColor="#3300cc" />
        <partstyle
          borderwidth="1px"   
          borderstyle="Solid"  
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text Content WebPart" 
            TitleUrl="HelpFile.htm"
            />
          </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>

備註

當您將 URL 指派給 TitleUrl 屬性時,控制項的標題會變成控制項的補充資訊連結。 當頁面處於可拖曳控制項的顯示模式時,不會轉譯 URL,例如設計、編輯或目錄模式。

這個屬性無法由佈景主題或樣式表主題設定。 如需詳細資訊,請參閱 ThemeableAttributeASP.NET 主題和麵板

此屬性的個人化範圍會設定為 Shared ,而且只能由授權的使用者修改。 如需詳細資訊,請參閱 PersonalizableAttributeWeb 組件個人化概觀

適用於

另請參閱