2 In this case, we have a checkbox inside a repeater control, which is a
3 naming container. We need to make sure to use the correct attribute on
4 the label element so that the browser knows how to hook up the label
8 <%@ Page Language="C#" AutoEventWireup="True" %>
9 <%@ Import Namespace="System.Data" %>
13 <script runat="server">
14 void Page_Load (object s, EventArgs e)
19 DataTable t = new DataTable ("t");
21 t.Columns.Add (new DataColumn ("Symbol", typeof (string)));
22 t.Columns.Add (new DataColumn ("Company", typeof (string)));
23 t.Columns.Add (new DataColumn ("Price", typeof (double)));
25 DataSet ds = new DataSet ("ds");
28 AddStock (t, "MSFT", "Microsoft Corp.", 25.81);
29 AddStock (t, "NOVL", "Novell Inc.", 6.17);
30 AddStock (t, "GOOG", "Google", 300.95);
37 void AddStock (DataTable dt, string symbol, string co, double price)
39 DataRow dr = dt.NewRow ();
48 <asp:Label id="lbl1" runat="server" />
50 <asp:Repeater id="rep" runat="server">
64 <td><%# DataBinder.Eval (Container.DataItem, "Symbol") %></td>
65 <td><%# DataBinder.Eval (Container.DataItem, "Company") %></td>
66 <td><%# DataBinder.Eval (Container.DataItem, "Price") %></td>
67 <td><asp:checkbox id="buy" runat="server" text="Buy"/></td>