WebPartZoneBase.EmptyZoneText 属性

定义

获取或设置在 WebPartZoneBase 控件不包含任何 WebPart 控件时出现的消息。

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

属性值

String

一个字符串,其中包含在空区域中显示的消息。 默认的区域性特定字符串由 .NET Framework 提供。

示例

下面的代码示例演示控件上WebPartZone属性的EmptyZoneText声明性用法。 有关完整代码示例,包括代码隐藏源文件和包含此代码中的区域的 .aspx 页,请参阅 WebPartZoneBase 类概述。

请注意,该 EmptyZoneText 属性在声明性标记中为其分配了一个值。 将页面加载到浏览器中后,此值将显示在 WebPartZone2浏览器中,将页面切换到设计显示模式,并将显示日期 WebPartZone2 的控件拖动到其中 WebPartZone1。 有关在Web 部件页面中更改显示模式的详细信息,请参阅演练:更改Web 部件页上的显示模式

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

注解

EmptyZoneText 属性重写基属性以区分尚未设置属性的情况,以及已设置为空字符串 (“”) 的情况。

如果未设置该属性并且区域不包含任何控件,则当Web 部件页面进入显示模式时,区域可见,则默认区域性特定的文本消息会显示在空WebPartZoneBase控件中。 EmptyZoneText如果属性值有意设置为空字符串,则不会在空区域中显示任何文本消息。

适用于

另请参阅