Muokkaa

Jaa


WebPartZoneBase.EmptyZoneText Property

Definition

Gets or sets a message that appears when a WebPartZoneBase control contains no WebPart controls.

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

Property Value

A string containing the message that appears in an empty zone. A default culture-specific string is supplied by the .NET Framework.

Examples

The following code example demonstrates the declarative use of the EmptyZoneText property on a WebPartZone control. For the full code example, including the code-behind source file and the .aspx page that contains the zone in this code, see the WebPartZoneBase class overview.

Notice that the EmptyZoneText property has a value assigned to it in the declarative markup. This value will appear in WebPartZone2, after you load the page into a browser, switch the page into design display mode, and drag the control that displays the date from WebPartZone2 into WebPartZone1. For more information on changing display modes in a Web Parts page, see Walkthrough: Changing Display Modes on a Web Parts Page.

<asp:WebPartZone 
  ID="WebPartZone2"
  Runat="server" 
  DragHighlightColor="#00ff00"
  AllowLayoutChange="true"
  EmptyZoneText="Add WebParts to this empty Zone."
  BorderWidth="2"
  BorderColor="DarkBlue"
  BorderStyle="Dashed" 
  MenuLabelText="Verbs Menu" 
  MenuPopupImageUrl="label.gif" >
  <VerbStyle Font-Italic="true" />
  <MenuLabelStyle BackColor="Lime" BorderWidth="1"  />
  <MenuLabelHoverStyle Font-Bold="true" />
  <MenuVerbHoverStyle BackColor="LightGrey" />
  <MenuVerbStyle Font-Italic="true" /> 
  <ZoneTemplate>
    <asp:Label ID="Label1" Runat="server" Title="Date" />
  </ZoneTemplate>
</asp:WebPartZone>
<asp:WebPartZone 
  ID="WebPartZone2"
  Runat="server" 
  DragHighlightColor="#00ff00"
  AllowLayoutChange="true"
  EmptyZoneText="Add WebParts to this empty Zone."
  BorderWidth="2"
  BorderColor="DarkBlue"
  BorderStyle="Dashed" 
  MenuLabelText="Verbs Menu" 
  MenuPopupImageUrl="label.gif" >
  <VerbStyle Font-Italic="true" />
  <MenuLabelStyle BackColor="Lime" BorderWidth="1"  />
  <MenuLabelHoverStyle Font-Bold="true" />
  <MenuVerbHoverStyle BackColor="LightGrey" />
  <MenuVerbStyle Font-Italic="true" /> 
  <ZoneTemplate>
    <asp:Label ID="Label1" Runat="server" Title="Date" />
  </ZoneTemplate>
</asp:WebPartZone>

Remarks

The EmptyZoneText property overrides the base property to distinguish between cases where the property has not been set and those where it has been set to an empty string ("").

If the property has not been set and the zone contains no controls, when a Web Parts page enters into a display mode where the zone is visible, a default culture-specific text message appears in an empty WebPartZoneBase control. If the EmptyZoneText property value has intentionally been set to an empty string, then no text message appears in an empty zone.

Applies to

See also