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 部件控件的属性。 本示例假定使用自定义控件, TextDisplayWebPart该控件位于类概述的 WebPart “示例”部分中。

请注意,该 <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。

无法通过主题或样式表主题设置此属性。 有关详细信息,请参阅 ThemeableAttribute ASP.NET 主题和外观

此属性的个性化范围设置为 Shared 授权用户,并且只能由授权用户修改。 有关详细信息,请参阅PersonalizableAttributeWeb 部件个性化设置概述

适用于

另请参阅