DetailsView.EmptyDataText Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Denetim herhangi bir kayıt içermeyen bir DetailsView veri kaynağına bağlı olduğunda işlenen boş veri satırında görüntülenecek metni alır veya ayarlar.
public:
virtual property System::String ^ EmptyDataText { System::String ^ get(); void set(System::String ^ value); };
public virtual string EmptyDataText { get; set; }
member this.EmptyDataText : string with get, set
Public Overridable Property EmptyDataText As String
Özellik Değeri
Boş veri satırında görüntülenecek metin. Varsayılan değer, bu özelliğin ayarlanmadığını gösteren boş bir dizedir ("").
Örnekler
Aşağıdaki kod örneği, boş veri satırında görüntülenecek metni belirtmek için özelliğinin nasıl kullanılacağını EmptyDataText gösterir.
<%@ Page language="C#" %>
<!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 runat="server">
<title>DetailsView EmptyDataText Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>DetailsView EmptyDataText Example</h3>
<asp:detailsview id="StoresDetailView"
datasourceid="StoresDetailsSqlDataSource"
autogeneraterows="true"
EmptyDataText="No records."
runat="server">
<emptydatarowstyle backcolor="Navy"
forecolor="Red"/>
</asp:detailsview>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Pubs sample database. -->
<!-- The select query of the following SqlDataSource -->
<!-- control has been intentionally set to return no -->
<!-- results to demonstrate the empty data row. -->
<asp:sqldatasource id="StoresDetailsSqlDataSource"
selectcommand="SELECT [stor_id], [stor_name], [stor_address], [city], [state], [zip] FROM [stores] WHERE [state]='FL'"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server">
</asp:sqldatasource>
</form>
</body>
</html>
<%@ Page language="VB" %>
<!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 runat="server">
<title>DetailsView EmptyDataText Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>DetailsView EmptyDataText Example</h3>
<asp:detailsview id="StoresDetailView"
datasourceid="StoresDetailsSqlDataSource"
autogeneraterows="true"
EmptyDataText="No records."
runat="server">
<emptydatarowstyle backcolor="Navy"
forecolor="Red"/>
</asp:detailsview>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Pubs sample database. -->
<!-- The select query of the following SqlDataSource -->
<!-- control has been intentionally set to return no -->
<!-- results to demonstrate the empty data row. -->
<asp:sqldatasource id="StoresDetailsSqlDataSource"
selectcommand="SELECT [stor_id], [stor_name], [stor_address], [city], [state], [zip] FROM [stores] WHERE [state]='FL'"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server">
</asp:sqldatasource>
</form>
</body>
</html>
Açıklamalar
Denetime bağlı veri kaynağı herhangi bir DetailsView kayıt içermediğinde boş veri satırı denetimde görüntülenir. EmptyDataText Boş veri satırında görüntülenecek metni belirtmek için özelliğini kullanın. Boş veri satırının stilini denetlemek için özelliğini kullanın EmptyDataRowStyle . Alternatif olarak, bu özellik yerine özelliğini ayarlayarak EmptyDataTemplate boş veri satırı için kendi özel kullanıcı arabiriminizi (UI) tanımlayabilirsiniz.
Not
Hem hem EmptyDataTemplate de EmptyDataText özellikleri ayarlanırsa, EmptyDataTemplate özelliği öncelikli olur.
değeri EmptyDataText görünüm durumunda depolanır.
Bu özelliğin değeri ayarlandığında, tasarımcı aracı kullanılarak otomatik olarak bir kaynak dosyasına kaydedilebilir. Daha fazla bilgi için bkz LocalizableAttribute . ve Genelleştirme ve Yerelleştirme.