FormView.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 FormView kayıt içermeyen bir 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, bu özelliğin ayarlanmadığını gösteren boş bir dizedir ("").
Örnekler
Aşağıdaki örnek, 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>FormView EmptyDataText Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>FormView EmptyDataText Example</h3>
<asp:formview id="EmployeeFormView"
datasourceid="EmployeeSource"
allowpaging="true"
datakeynames="EmployeeID"
emptydatatext="No records available."
runat="server">
<EmptyDataRowStyle BackColor="Red"
forecolor="White"
font-size="14"
font-italic="true"
height="100"/>
<itemtemplate>
<table>
<tr>
<td>
<asp:image id="EmployeeImage"
imageurl='<%# Eval("PhotoPath") %>'
alternatetext='<%# Eval("LastName") %>'
runat="server"/>
</td>
<td>
<h3><%# Eval("FirstName") %> <%# Eval("LastName") %></h3>
<%# Eval("Title") %>
</td>
</tr>
</table>
</itemtemplate>
<pagersettings position="Bottom"
mode="NextPrevious"/>
</asp:formview>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Northwind sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<!-- The select query for the following SqlDataSource -->
<!-- control is intentionally set to return no results -->
<!-- to demonstrate the empty data row. -->
<asp:sqldatasource id="EmployeeSource"
selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees] Where [EmployeeID]=1000"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>
</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>FormView EmptyDataText Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>FormView EmptyDataText Example</h3>
<asp:formview id="EmployeeFormView"
datasourceid="EmployeeSource"
allowpaging="true"
datakeynames="EmployeeID"
emptydatatext="No records available."
runat="server">
<EmptyDataRowStyle BackColor="Red"
forecolor="White"
font-size="14"
font-italic="true"
height="100"/>
<itemtemplate>
<table>
<tr>
<td>
<asp:image id="EmployeeImage"
imageurl='<%# Eval("PhotoPath") %>'
alternatetext='<%# Eval("LastName") %>'
runat="server"/>
</td>
<td>
<h3><%# Eval("FirstName") %> <%# Eval("LastName") %></h3>
<%# Eval("Title") %>
</td>
</tr>
</table>
</itemtemplate>
<pagersettings position="Bottom"
mode="NextPrevious"/>
</asp:formview>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Northwind sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<!-- The select query for the following SqlDataSource -->
<!-- control is intentionally set to return no results -->
<!-- to demonstrate the empty data row. -->
<asp:sqldatasource id="EmployeeSource"
selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees] Where [EmployeeID]=1000"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>
</form>
</body>
</html>
Açıklamalar
Denetime bağlı veri kaynağı herhangi bir kayıt içermediğinde boş veri satırı denetimde FormView 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.
Uyarı
hem ve EmptyDataTextEmptyDataTemplate özellikleri ayarlanırsa, EmptyDataTemplate özelliği öncelikli olur.
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.