CatalogZoneBase.SelectTargetZoneText 属性

定义

获取或设置目录用户界面 (UI) 中的控件旁边的文本,该控件允许用户选择将所选控件添加到哪个区域。

public:
 virtual property System::String ^ SelectTargetZoneText { System::String ^ get(); void set(System::String ^ value); };
public virtual string SelectTargetZoneText { get; set; }
member this.SelectTargetZoneText : string with get, set
Public Overridable Property SelectTargetZoneText As String

属性值

字符串,包含在区域选择控件旁边显示的文本。 默认的区域性特定字符串由 .NET Framework 提供。

示例

下面的代码示例演示如何以声明方式和编程方式使用 SelectTargetZoneText 属性。 有关运行示例所需的完整代码,请参阅类概述的 CatalogZoneBase “示例”部分。

请注意,代码示例的第一部分声明两 <asp:catalogzone> 个元素,第一部分声明 SelectTargetZoneText 属性的值。

<asp:CatalogZone ID="CatalogZone1" runat="server"
  EmptyZoneText="No controls are in the zone."
  HeaderText="My Web Parts Catalog"
  InstructionText="Add Web Parts controls to the zone."
  PartLinkStyle-Font-Italic="true"
  SelectedPartLinkStyle-Font-Bold="true"
  SelectTargetZoneText="Select zone"
  AddVerb-Text="Add Control"
  CloseVerb-Description="Close and return to browse mode." 
  SelectedCatalogPartID="Currently Selected CatalogPart ID.">
  <ZoneTemplate>
    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
      runat="server">
      <WebPartsTemplate>
        <aspSample:TextDisplayWebPart 
          runat="server"   
          id="textwebpart" 
          title = "Text Content WebPart" 
          ExportMode="All"/>  
        <asp:Calendar id="calendar1" runat="server" 
          Title="My Calendar" />               
      </WebPartsTemplate>
    </asp:DeclarativeCatalogPart> 
    <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
    <asp:ImportCatalogPart ID="ImportCatalogPart1" runat="server" /> 
  </ZoneTemplate>
</asp:CatalogZone>
<hr />
<asp:CatalogZone ID="CatalogZone2" runat="server"
  BorderWidth="2"
  HeaderText="My Empty CatalogZone"
  EmptyZoneText="No controls are in the zone." />
<asp:CatalogZone ID="CatalogZone1" runat="server"
  EmptyZoneText="No controls are in the zone."
  HeaderText="My Web Parts Catalog"
  InstructionText="Add Web Parts controls to the zone."
  PartLinkStyle-Font-Italic="true"
  SelectedPartLinkStyle-Font-Bold="true"
  SelectTargetZoneText="Select zone"
  AddVerb-Text="Add Control"
  CloseVerb-Description="Close and return to browse mode." 
  SelectedCatalogPartID="Currently Selected CatalogPart ID.">
  <ZoneTemplate>
    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
      runat="server">
      <WebPartsTemplate>
        <aspSample:TextDisplayWebPart 
          runat="server"   
          id="textwebpart" 
          title = "Text Content WebPart" 
          ExportMode="All"/>  
        <asp:Calendar id="calendar1" runat="server" 
          Title="My Calendar" />               
      </WebPartsTemplate>
    </asp:DeclarativeCatalogPart> 
    <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
    <asp:ImportCatalogPart ID="ImportCatalogPart1" runat="server" /> 
  </ZoneTemplate>
</asp:CatalogZone>
<hr />
<asp:CatalogZone ID="CatalogZone2" runat="server"
  BorderWidth="2"
  HeaderText="My Empty CatalogZone"
  EmptyZoneText="No controls are in the zone." />

在代码示例的第二部分中,以编程方式更改 属性的值 SelectTargetZoneText

protected void Button3_Click(object sender, EventArgs e)
{
  CatalogZone1.SelectTargetZoneText = "Add to zone";
  CatalogZone1.EmptyZoneText = "Zone is empty";
  CatalogZone1.HeaderText = "My Updated Header";
  CatalogZone1.InstructionText = "My Updated Instructions";
}
Protected Sub Button3_Click(ByVal sender As Object, _
  ByVal e As EventArgs)
  CatalogZone1.SelectTargetZoneText = "Add to zone"
  CatalogZone1.EmptyZoneText = "Zone is empty"
  CatalogZone1.HeaderText = "My Updated Header"
  CatalogZone1.InstructionText = "My Updated Instructions"
End Sub

在浏览器中加载页面时,可以从下拉列表中选择“ 目录 ”以切换到目录显示模式。 当目录可见时,请注意目录页脚中控件旁边 DropDownList 显示的文本。 可以单击“ 设置区域文本属性” 按钮更改属性的文本值。

注解

首次显示目录 UI 时,用户可以选择包含WebPart或可添加到网页的其他服务器控件之一CatalogPart,例如 DeclarativeCatalogPart。 用户选择一个或多个控件,然后 DropDownList 可以使用目录页脚区域中的控件,并在要放置所选服务器控件的页面上选择 WebPartZone 控件。 属性的文本值 SelectTargetZoneText 作为简单指令与 控件一起 DropDownList 显示。

设置此属性的值时,可以使用设计器工具自动保存到资源文件。 有关详细信息,请参阅 LocalizableAttribute全球化和本地化

适用于

另请参阅