您的位置:首页 > 运维架构

GridView.EmptyDataRowStyle Property

2013-09-10 15:39 295 查看
原帖地址:http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.emptydatarowstyle.aspx
<%@ 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>GridView EmptyDataTemplate Example</title>
</head>
<body>
<form id="form1" runat="server">

<h3>GridView EmptyDataTemplate Example</h3>

<asp:gridview id="CustomersGridView"
datasourceid="CustomersSqlDataSource"
autogeneratecolumns="true"
runat="server">

<emptydatarowstyle backcolor="LightBlue"
forecolor="Red"/>

<emptydatatemplate>

<asp:image id="NoDataImage"
imageurl="~/images/Image.jpg"
alternatetext="No Image"
runat="server"/>

No Data Found.

</emptydatatemplate>

</asp:gridview>

<!-- 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 following query        -->
<!-- returns an empty data source to demonstrate the      -->
<!-- empty row.                                           -->
<asp:sqldatasource id="CustomersSqlDataSource"
selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers] Where CustomerID='NoID'"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server">
</asp:sqldatasource>

</form>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: