1 <%@ Page Language="C#" AutoEventWireup="true" %>
2 <%@ Import Namespace="System.Data" %>
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml" >
7 <title>Untitled Page</title>
8 <script runat="server">
9 public class DataObject
11 public static DataTable ds = CreateDataTable ();
12 public static DataTable Select ()
17 public static DataTable CreateDataTable ()
19 DataTable aTable = new DataTable ("A");
23 // Create ID column and add to the DataTable.
24 dtCol = new DataColumn ();
25 dtCol.DataType = Type.GetType ("System.String");
26 dtCol.ColumnName = "ID";
28 dtCol.ReadOnly = true;
30 aTable.Columns.Add (dtCol);
32 dtRow = aTable.NewRow ();
33 dtRow["ID"] = "My databind test";
34 aTable.Rows.Add (dtRow);
36 aTable.PrimaryKey = new DataColumn[] { aTable.Columns["ID"] };
40 protected override void OnLoad (EventArgs e)
43 Repeater1.DataSource = DataObject.Select ();
44 Repeater1.DataMember = "A";
45 Repeater1.DataBind ();
51 <form id="form1" runat="server">
53 <asp:Repeater ID="Repeater1"
58 <td><font color="blue"><%# Eval ("ID")%></font></td>