Bagikan melalui


WebPartZoneBase.EmptyZoneText Properti

Definisi

Mendapatkan atau mengatur pesan yang muncul saat WebPartZoneBase kontrol tidak WebPart berisi kontrol.

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

Nilai Properti

String yang berisi pesan yang muncul di zona kosong. String khusus budaya default disediakan oleh .NET Framework.

Contoh

Contoh kode berikut menunjukkan penggunaan EmptyZoneText deklaratif properti pada WebPartZone kontrol. Untuk contoh kode lengkap, termasuk file sumber code-behind dan halaman .aspx yang berisi zona dalam kode ini, lihat WebPartZoneBase gambaran umum kelas.

Perhatikan bahwa EmptyZoneText properti memiliki nilai yang ditetapkan untuknya dalam markup deklaratif. Nilai ini akan muncul di WebPartZone2, setelah Anda memuat halaman ke browser, alihkan halaman ke mode tampilan desain, dan seret kontrol yang menampilkan tanggal dari WebPartZone2 ke dalam WebPartZone1. Untuk informasi selengkapnya tentang mengubah mode tampilan di halaman Bagian Web, lihat Panduan: Mengubah Mode Tampilan pada Halaman Bagian 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>

Keterangan

Properti EmptyZoneText mengambil alih properti dasar untuk membedakan antara kasus di mana properti belum diatur dan properti yang telah diatur ke string kosong ("").

Jika properti belum diatur dan zona tidak berisi kontrol, ketika halaman Bagian Web masuk ke mode tampilan di mana zona terlihat, pesan teks khusus budaya default muncul dalam kontrol kosong WebPartZoneBase . EmptyZoneText Jika nilai properti sengaja diatur ke string kosong, maka tidak ada pesan teks yang muncul di zona kosong.

Berlaku untuk

Lihat juga