ASP.NET SqlDataSource - DataSourceMode DataReader

SqlDataSource DataSourceMode DataReader
DataSourceModeDataReader.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>asp.net SqlDataSource example: DataSourceMode DataReader</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">DataSourceMode DataReader Example</h2>
        <asp:SqlDataSource
             ID="SqlDataSource1"
             runat="server"
             ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
             DataSourceMode="DataReader"
             SelectCommand="SELECT TOP 4 ProductID, ProductName, UnitPrice FROM Products"
             >
        </asp:SqlDataSource>
        <asp:Label ID="Label1" runat="server" Text="Sorting and Paging are disable <br /> in DataSourceMode DataReader" Font-Bold="true" ForeColor="SandyBrown">
        </asp:Label>
        <hr />
        <asp:GridView
             ID="GridView1"
             runat="server"
             DataSourceID="SqlDataSource1"
             AllowPaging="false"
             AllowSorting="false"
             BackColor="Azure"
             ForeColor="Maroon"
             HeaderStyle-BackColor="Red"
             HeaderStyle-ForeColor="AntiqueWhite"
             >
        </asp:GridView>
    </div>
    </form>
</body>
</html>
More asp.net examples