班级名称 | 开班时间 | 状态 | |||
用来绑定列表或其它数据的.如:
CS:
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("id", typeof(string)));
dt.Columns.Add(new DataColumn("name", typeof(string)));
for (int ii = 1; ii < 11; ii++) {
DataRow newDr = dt.NewRow();
newDr["id"] = ii;
newDr["name"] = "my name is "+ii;
dt.Rows.Add(newDr);
}
this.rtData.DataSource = dt;
this.rtData.DataBind();
ASPX:
id | name |
<%# Eval("id")%> | <%# Eval("name")%> |
IList
PagedDataSource pdslist = new PagedDataSource();
pdslist.DataSource = news;
if (news.Count > 0)
{
pdslist.AllowPaging = true;
pdslist.PageSize = this.AspNetPager1.PageSize;//取控件的分页大小
pdslist.CurrentPageIndex = this.AspNetPager1.CurrentPageIndex - 1;
this.AspNetPager1.RecordCount = news.Count;
this.Repeater1.DataSource = pdslist;
this.Repeater1.DataBind();
}
else
{
this.Repeater1.DataSource = "";
this.Repeater1.DataBind();
}
囧 那么多控件里 就这个会用....~
情何以堪
只要在里面写代码 他会根据你datasource的size循环的
然后eval就可以了