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如果屬性值刻意設定為空字串,則不會在空白區域中顯示任何文字訊息。

適用於

另請參閱