Mega Code Archive

 
Categories / ASP.Net Tutorial / ADO Net Database
 

A grid with an empty data source

<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">     <title>Empty Grid</title> </head> <body>     <div id="pageContent">         <form id="form1" runat="server">         <asp:SqlDataSource ID="SqlDataSource1" runat="server" EnableCaching="true"                    ConnectionString='<%$ ConnectionStrings:NorthwindConnectionString %>'                 SelectCommand="SELECT customerid, companyname FROM customers WHERE customerid='none'">         </asp:SqlDataSource>          <asp:gridview ID="Gridview1" runat="server" datasourceid="SqlDataSource1">             <emptydatatemplate>                 <asp:label ID="Label1" runat="server">                     There's no data to show in this view.                 </asp:label>             </emptydatatemplate>         </asp:gridview>         </form>     </div> </body> </html>