CatalogZoneBase.HeaderText 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定區域的頁首區域文字。
public:
virtual property System::String ^ HeaderText { System::String ^ get(); void set(System::String ^ value); };
public override string HeaderText { get; set; }
member this.HeaderText : string with get, set
Public Overrides Property HeaderText As String
屬性值
此字串包含區域的頁首文字。 預設的特定文化特性字串是由 .NET Framework 所提供。
範例
下列程式碼範例示範如何以宣告方式和程式設計方式使用 HeaderText 屬性。 如需執行範例所需的完整程式碼,請參閱類別概觀的 CatalogZoneBase 範例一節。
請注意,程式碼範例會宣告兩 <asp:catalogzone>
個元素。 第二個控制項不會宣告任何 CatalogPart 控制項,但兩者都會宣告 屬性的值 HeaderText 。
<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." />
在程式碼範例的第二個部分中,第一個區域中的 HeaderText 屬性值會以程式設計方式指派給不同的值。
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
當您在瀏覽器中載入頁面時,您可以從下拉式清單中選取 [目錄 ],以切換至目錄顯示模式。 當目錄可見時,請注意每個區域標頭區域中顯示的每個 HeaderText 屬性值。 您可以按一下 [ 設定區域文字屬性 ] 按鈕,而 HeaderText 上方區域的 屬性會設定為程式碼中指派給它的值。
備註
屬性的 HeaderText 字串值會顯示在區域標頭區域中,該區域 CatalogZoneBase 位於區域的頂端。 當頁面進入類別目錄模式,而目錄使用者介面 (UI) 變成可見時,就會顯示內容的文字 HeaderText 。
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應