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

プロパティ値

空のゾーンに表示されるメッセージを含む文字列。 カルチャ固有の既定の文字列は、.NET Framework によって提供されます。

次のコード例では、コントロールで プロパティを EmptyZoneText 宣言的に使用する方法を WebPartZone 示します。 分離コード ソース ファイルや、このコードのゾーンを含む .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 意図的に空の文字列に設定されている場合、空のゾーンにテキスト メッセージは表示されません。

適用対象

こちらもご覧ください