ASP.NET GridView - How to use asp:BoundFiled

asp.net BoundField example: how to use asp:BoundFiled
BoundFieldExample.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 BoundField example: how to use asp:BoundFiled</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">BoundField Example</h2>
        <asp:SqlDataSource
             ID="SqlDataSource1"
             runat="server"
             ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
             SelectCommand="SELECT TOP 5 ProductID, ProductName, UnitPrice FROM Products"
             >
        </asp:SqlDataSource>
        <asp:GridView
             ID="GridView1" 
             runat="server"
             DataSourceID="SqlDataSource1"
             AutoGenerateColumns="false"
             BackColor="Cornsilk"
             ForeColor="DarkOrchid"
             BorderColor="DarkSlateBlue"
             >
            <Columns>
                <asp:BoundField HeaderText="Product ID" DataField="ProductID" />
                <asp:BoundField HeaderText="Product Name" DataField="ProductName" />
                <asp:BoundField HeaderText="Unit Price" DataField="UnitPrice" />
            </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
</html>




Related asp.net example

buy asp.net c# examples ebook (450+ best examples ebook $5 only)

enter your email to receive book

please allow me few hours to send your ebook.