CatalogZoneBase.InstructionText 屬性

定義

取得或設定為使用者提供指示之區域中的文字。

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

屬性值

String

字串,包含終端使用者的指示。 預設值是 Web 組件控制集所提供的文化特性字串。

範例

下列程式碼範例示範如何以宣告方式和程式設計方式使用 InstructionText 屬性。 如需執行範例所需的完整程式碼,請參閱類別概觀的 CatalogZoneBase 範例一節。

請注意,程式碼範例會宣告兩 <asp:catalogzone> 個專案,而第一個範例會宣告 屬性的值 InstructionText

<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." />

在程式碼範例的第二個部分中,第 InstructionText 一個區域中的 屬性值會以程式設計方式指派給不同的值。

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

當您在瀏覽器中載入頁面時,您可以從下拉式清單中選取 [ 目錄 ],以切換至目錄顯示模式。 當目錄可見時,請注意 InstructionText 每個區域的標頭區域中所顯示的 屬性值。 您可以按一下 [ 設定區域文字屬性 ] 按鈕,而 InstructionText 上方區域的 屬性會設定為程式碼中指派給它的值。

備註

屬性的 InstructionText 字串值會顯示在區域標頭區域 CatalogZoneBase 正下方。 當頁面進入目錄模式,而目錄使用者介面 (UI) 變成可見時,就會顯示內容的文字 InstructionText

屬性的目的是 InstructionText 要為使用者提供在顯示類別目錄 UI 時要執行的一般指示。

適用於

另請參閱