日期:2014-05-17 浏览次数:20512 次
string sql = "select top 30 ID,Title,Src from Products";
var modelList = WebApp.DAL.DBHelper.Query(sql).Tables[0];
for (int i = 1; i < modelList.Rows.Count; i++)
{
if (i<=10)
{
List<Products> modelList_1 = new List<Products>();
Products model = new Products();
model.ID=int.Parse(modelList.Rows[i]["ID"].ToString());
model.Title = modelList.Rows[i]["ID"].ToString();
model.Src = modelList.Rows[i]["Src"].ToString();
modelList_1.Add(model);
Repeater_1.DataSource = modelList_1;
Repeater_1.DataBind();
}
if (i <= 20 && i > 10)
{
List<Products> modelList_2 = new List<Products>();
Products model = new Products();
model.ID = int.Parse(modelList.Rows[i]["ID"].ToString());
model.Title = modelList.Rows[i]["ID"].ToString();
model.Src = modelList.Rows[i]["Src"].ToString();
modelList_2.Add(model);
Repeater_2.DataSource = modelList_2;
Repeater_2.DataBind();
}
if (i <= 30 && i>20)
{
&nb