You need to define a checkbox column as a TemplateField.
Below is an example showing how to retrieve the key of each checked item.
CheckBoxExample.aspx
view sourceprint?
01 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="CheckBoxExample.aspx.cs" Inherits="CheckBoxExample" %>
02
03 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
04
05 <html xmlns="http://www.w3.org/1999/xhtml" >
06 <head runat="server">
07 <title>CheckBox Example</title>
08 </head>
09 <body>
10 <form id="form1" runat="server">
11 <div>
12 <asp:GridView ID="ProductGridView" runat="server" AutoGenerateColumns="False" DataKeyNames="ItemId">
13 <Columns>
14 <asp:BoundField DataField="ItemDescription" DataFormatString="{0}" HeaderText="Item" />
15 <asp:BoundField DataField="ItemPrice" DataFormatString="{0:C}" HeaderText="Price" />
16 <asp:TemplateField HeaderText="Purchase">
17 <ItemTemplate>
18 <asp:CheckBox ID="CheckBoxPurchase" runat="server" Enabled="true" />
19 </ItemTemplate>
20 </asp:TemplateField>
21 </Columns>
22 </asp:GridView>
23 <asp:Button ID="Purchase" runat="server" Text="Purchase Checked Items" />
24 </div>
25 </form>
26 </body>
27 </html>