Export (0) Print
Expand All

CatalogZoneBase.HeaderText Property

Gets or sets the text for the header area of a zone.

Namespace:  System.Web.UI.WebControls.WebParts
Assembly:  System.Web (in System.Web.dll)

public override string HeaderText { get; set; }
<asp:CatalogZoneBase HeaderText="String" />

Property Value

Type: System.String
A string that contains the header text for the zone. A default culture-specific string is supplied by the .NET Framework.

The string value of the HeaderText property is displayed in the header area of a CatalogZoneBase zone, which is at the very top of the zone. The text of the HeaderText property is displayed when a page enters catalog mode and the catalog user interface (UI) becomes visible.

The following code example demonstrates how to use the HeaderText property declaratively and programmatically. For the full code required to run the example, see the Example section of the CatalogZoneBase class overview.

Notice that the code example declares two <asp:catalogzone> elements. The second one does not declare any CatalogPart controls, but both declare a value for the HeaderText property.

<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."
  SelectTargetZoneText="Select zone"
  AddVerb-Text="Add Control"
  CloseVerb-Description="Close and return to browse mode." 
  SelectedCatalogPartID="Currently Selected CatalogPart ID.">
    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
          title = "Text Content WebPart" 
        <asp:Calendar id="calendar1" runat="server" 
          Title="My Calendar" />               
    <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
    <asp:ImportCatalogPart ID="ImportCatalogPart1" runat="server" /> 
<hr />
<asp:CatalogZone ID="CatalogZone2" runat="server"
  HeaderText="My Empty CatalogZone"
  EmptyZoneText="No controls are in the zone." />

In the second part of the code example, the value of the HeaderText property in the first zone is programmatically assigned to a different value.

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";

When you load the page in a browser, you can select Catalog from the drop-down list to switch to catalog display mode. When the catalog is visible, notice the values of each HeaderText property displayed in the header area of each zone. You can click the Set Zone Text Properties button, and the HeaderText property of the upper zone is set to the value assigned to it in the code.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft