一、下面的代码实现
:
<tabel>
<tr>
<asp:repeater id="Repeater1" runat="server">
<Templat Barang>
<td><%#DataBinder.Eval(Container.DataItem,"sesuatu")%></td>
</Templat Barang>
</asp:pengulang>
</tr>
</tabel>
后台代码:
dilindungi int i=1;
private void Page_Load(pengirim objek, System.EventArgs e)
{
XmlSerializer ser = XmlSerializer baru(typeof(DataSet));
DataSet ds = DataSet baru("MyDataSet");
DataTable t = DataTable baru("tabel1");
DataColumn c = DataColumn baru("benda");
t.Kolom.Tambahkan(c);
ds.Tabel.Tambahkan(t);
Baris Data r;
untuk(int saya = 0; saya<10;i++)
{
r = t.Baris Baru();
r[0] = saya;
t.Baris.Tambahkan(r);
}
this.Repeater1 .DataSource =ds.Tables [0].DefaultView ;
ini.Repeater1.DataBind();
}
private void Repeater1_ItemDataBound(pengirim objek, System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
jika(i%3==0&&i>0)
{
e.Item.Controls.Add(new LiteralControl("</tr><tr>"));
}
saya++;
}
http://www.cnblogs.com/bccu/archive/2006/10/24/538506.html