日期:2014-05-18 浏览次数:20435 次
<asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound"> <ItemTemplate> <div id="divContainer" runat="server"> </div> </ItemTemplate> </asp:Repeater>
------解决方案--------------------
private DataTable subtable(int i, int j, DataTable dt)
{
int t;
DataTable table = new DataTable();
for (t = 0; t < dt.Columns.Count; t++)
table.Columns.Add(dt.Columns[t].ColumnName.ToString());
for (t = i; t < j; t++)
table.Rows.Add();
for (t = 0; t < dt.Columns.Count; t++)
for (int r = i; r < j; r++)
table.Rows[r - i][t] = dt.Rows[r][t];
return table;
}
直接将table取出n行来。
------解决方案--------------------
public static int PageBindRepeater(int curPage,int pageSize, Repeater rep,string strSql) { PagedDataSource pds = new PagedDataSource(); pds.DataSource = DbHelperSQL.GetTable(strSql).DefaultView; pds.AllowPaging = true; pds.PageSize = pageSize; pds.CurrentPageIndex = curPage - 1; rep.DataSource = pds; rep.DataBind(); return pds.PageCount; }
------解决方案--------------------
其实这样就可以了:
<asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound"> <ItemTemplate> <%#Eval("姓名") %><br /> </ItemTemplate> </asp:Repeater>