A grid with an empty data source. : LINQ « ADO.net Database « ASP.NET Tutorial






<%@ 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>








18.50.LINQ
18.50.1.use Linq-to-Objects to query against .NET collections using the LINQ syntax
18.50.2.Use Linq-to-DataSets to query against (typed) DataTables and DataSets using the LINQ syntax
18.50.3.A grid with an empty data source.