ASP.NET - How to use CheckBoxField in DetailsView

DetailsView CheckBoxField
DetailsViewCheckBoxFieldExample.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 id="Head1" runat="server">
    <title>asp.net asp:CheckBoxField example: how to use CheckBoxField in DetailsView</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">DetailsView CheckBoxField Example</h2>
        <asp:Label ID="Label1" runat="server" Font-Italic="true" ForeColor="Red"></asp:Label>
        <asp:SqlDataSource 
            ID="SqlDataSource1"
            runat="server"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT ProductID, ProductName, UnitPrice, Discontinued FROM Products"
            >
        </asp:SqlDataSource>
        <asp:DetailsView 
            ID="DetailsView1"
            runat="server"
            DataSourceID="SqlDataSource1"
            AllowPaging="true"
            ForeColor="AliceBlue"
            BackColor="DodgerBlue"
            BorderColor="LightSkyBlue"
            AutoGenerateRows="false"
            >
            <Fields>
                <asp:BoundField HeaderText="Product ID" DataField="ProductID" />
                <asp:BoundField HeaderText="Product Name" DataField="ProductName" />
                <asp:BoundField HeaderText="Unit Price" DataField="UnitPrice" />
                <asp:CheckBoxField HeaderText="Discontinued" DataField="Discontinued" />
            </Fields>
            <HeaderTemplate>
                <b>Product Details</b>
            </HeaderTemplate>
            <HeaderStyle BackColor="DarkBlue" />
        </asp:DetailsView>        
    </div>
    </form>
</body>
</html>




More asp.net examples