WebZone.EmptyZoneText 属性

定义

获取或设置当区域不包含任何控件时显示的消息。Gets or sets a message that appears when a zone contains no controls.

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

属性值

String

一个字符串,其中包含在空区域中显示的消息。A string containing the message that appears in an empty zone. 默认的区域性特定字符串由 .NET Framework 提供。A default culture-specific string is supplied by the .NET Framework.

示例

下面的代码示例演示属性的用法 EmptyZoneTextThe following code example demonstrates the use of the EmptyZoneText property. 请注意,声明性标记中有两个区域,第二个 <asp:webpartzone> 元素为空。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" 
      EmptyZoneText="No controls in this zone.">
    </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" 
      EmptyZoneText="No controls in this zone.">
    </asp:webpartzone>
  </form>
</body>
</html>

在浏览器中,您可以切换到设计模式来查看为 EmptyZoneText 空区域中显示的属性提供的文本。In a browser, you can switch to design mode to see the text supplied for the EmptyZoneText property displayed in the empty zone. 有关如何更改页显示模式的详细信息,请参阅 演练:更改 Web 部件页上的显示模式For details on how to change page display modes, see Walkthrough: Changing Display Modes on a Web Parts Page.

注解

EmptyZoneText当区域中没有控件并且区域处于个性化模式之一(如编辑、设计或目录模式)时,将显示属性中的文本。The text in the EmptyZoneText property appears when there are no controls in a zone, and the zone is in one of the personalization modes, such as edit, design, or catalog mode.

备注

当区域进入可允许对区域内容进行个性化设置更改的个性化设置模式之一时,该 WebPartManager 控件会将 WebPartDisplayMode.AllowPageDesign 属性值设置为 true 其属性中引用的显示模式对象上的属性值 WebPartManager.DisplayModeWhen a zone enters one of the personalization modes that would allow personalization changes to be made to the zone's contents, the WebPartManager control sets the WebPartDisplayMode.AllowPageDesign property value to true on the display mode object referenced in its WebPartManager.DisplayMode property.

适用于