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

屬性值

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 第一次出現時,使用者可以選取其中一個 CatalogPart 控制項,例如 DeclarativeCatalogPart ,其中包含 WebPart 或其他可新增至網頁的伺服器控制項。 使用者選取一或多個控制項,然後在目錄的頁尾區域中使用 DropDownList 控制項,然後選擇 WebPartZone 要放置所選伺服器控制項之頁面上的控制項。 屬性的 SelectTargetZoneText 文字值會與控制項一起 DropDownList 顯示為簡單指令。

當設定時,此屬性的值可以使用設計工具自動儲存到資源檔。 如需詳細資訊,請參閱 LocalizableAttribute 和全球化和當地語系化

適用於

另請參閱