Rediger

Del via


WebZone.HeaderText Property

Definition

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

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

Property Value

A string that contains the header text for the zone. The default is an empty string ("").

Examples

The following code example demonstrates the use of the HeaderText property. Note that there are two zones in the declarative markup, and the second <asp:webpartzone> element is empty.

<%@ page language="C#" %>
<%@ register TagPrefix="uc1" 
  TagName="DisplayModeMenuCS" 
  Src="DisplayModeMenuCS.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
    <asp:webpartmanager id="WebPartManager1" runat="server" />
    <uc1:DisplayModeMenuCS ID="DisplayModeMenu1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server">
        <zonetemplate>
          <asp:Calendar ID="cal1" Runat="server" Title="My Calendar" />
        </zonetemplate>
    </asp:webpartzone>
    <asp:webpartzone
      id="WebPartZone2"
      runat="server" 
      HeaderText="My Zone Header">
    </asp:webpartzone>
  </form>
</body>
</html>
<%@ page language="VB" %>
<%@ register TagPrefix="uc1" 
  TagName="DisplayModeMenuVB" 
  Src="DisplayModeMenuVB.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
    <asp:webpartmanager id="WebPartManager1" runat="server" />
    <uc1:DisplayModeMenuVB ID="DisplayModeMenu1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server">
        <zonetemplate>
          <asp:Calendar ID="cal1" Runat="server" Title="My Calendar" />
        </zonetemplate>
    </asp:webpartzone>
    <asp:webpartzone
      id="WebPartZone2"
      runat="server" 
      HeaderText="My Zone Header">
    </asp:webpartzone>
  </form>
</body>
</html>

In a browser, you can switch the page to design mode to see the text supplied for the HeaderText property displayed in the header area of the zone. For details on how to change page display modes, see Walkthrough: Changing Display Modes on a Web Parts Page.

Remarks

The contents of a zone's HeaderText property are displayed when a Web page enters certain display modes. For example, on a page that has a WebPartZone control, the text assigned to the HeaderText property becomes visible when the page enters edit, catalog, or design mode.

The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see LocalizableAttribute and Globalization and Localization.

Applies to

See also