WebPart.TitleUrl 属性
定义
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
属性值
一个字符串,表示有关 WebPart 控件详细信息的 URL。A string that represents a URL to more information about the WebPart control. 默认值为空字符串 ("")。The default value is an empty string ("").
实现
- 属性
例外
内部验证系统已确定 URL 可能包含脚本攻击。The internal validation system has determined that the URL might contain script attacks.
示例
下面的代码示例演示如何设置 TitleUrl 自定义 Web 部件控件的属性。The following code example demonstrates how to set the TitleUrl property for a custom Web Parts control. 本示例假定使用自定义控件,该控件 TextDisplayWebPart 位于类概述的 "示例" 部分 WebPart 。This example assumes the use of a custom control, TextDisplayWebPart, which is found in the Example section of the WebPart class overview.
请注意, <aspSample:TextDisplayWebPart> 元素包含 TitleUrl 具有虚构 URL 的属性。Notice that the <aspSample:TextDisplayWebPart> element contains the TitleUrl attribute with a fictitious URL. 如果在浏览器中加载页面,则控件的标题 WebPart 现在是指向属性指向的资源的链接 TitleUrl 。If you load the page in a browser, the title of the WebPart control is now a link to the resource pointed to by the TitleUrl property.
<%@ 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 ,控件的标题将变为指向有关控件的补充信息的链接。When you assign a URL to the TitleUrl property, the title of the control becomes a link to supplemental information about the control. 当页处于可拖动控件的显示模式(如设计、编辑或目录模式)时,不会呈现 URL。The URL is not rendered when the page is in a display mode where controls can be dragged, such as design, edit, or catalog mode.
无法通过主题或样式表主题设置此属性。This property cannot be set by themes or style sheet themes. 有关详细信息,请参阅 ThemeableAttribute 和 ASP.NET 主题和外观。For more information, see ThemeableAttribute and ASP.NET Themes and Skins.
此属性的个性化设置范围设置为 Shared ,并且只能由授权用户修改。The personalization scope of this property is set to Shared and can be modified only by authorized users. 有关详细信息,请参阅 PersonalizableAttribute 和 Web 部件个性化概述。For more information, see PersonalizableAttribute and Web Parts Personalization Overview.