没分了
StringBuilder shopText = new StringBuilder();
List<Let.Model.ModelAllList> modelList = new Let.BLL.photoList().ExecuteReader(CommandType.StoredProcedure, "P_ShopList",
new SqlParameter("@startIndex", AspNetPager1.StartRecordIndex),
new SqlParameter("@endIndex", AspNetPager1.EndRecordIndex)); if (modelList.Count > 0)
{
int count = 0;
for (int n = 0; n < 4; n++)
{
shopText.Append("<div class='divlist'>"); for (int i = 0; i < modelList.Count; i++)
{
if (i.Equals(30))
{
count = i;
break;
} if (i.Equals(60))
{
count = i;
break;
} if (i.Equals(90))
{
count = i;
break;
} if (i.Equals(120))
{
count = i;
break;
}
shopText.Append("<div class='t2'><ul class='shopUlList'><li><div class='t1'></div><img width='200px' src='/photo/200/" + modelList[i].Photolist.img + "'/></li></ul></div>"); } shopText.Append("</div>");
}
}
我想在i为30 60 90 120的时候 跳到外面的for循环 但是我现在当i等于30的时候 跳出后i又被初始化成0了我想i继续往下走 就是i为31 这个怎么改 ?
StringBuilder shopText = new StringBuilder();
List<Let.Model.ModelAllList> modelList = new Let.BLL.photoList().ExecuteReader(CommandType.StoredProcedure, "P_ShopList",
new SqlParameter("@startIndex", AspNetPager1.StartRecordIndex),
new SqlParameter("@endIndex", AspNetPager1.EndRecordIndex)); if (modelList.Count > 0)
{
int count = 0;
for (int n = 0; n < 4; n++)
{
shopText.Append("<div class='divlist'>"); for (int i = 0; i < modelList.Count; i++)
{
if (i.Equals(30))
{
count = i;
break;
} if (i.Equals(60))
{
count = i;
break;
} if (i.Equals(90))
{
count = i;
break;
} if (i.Equals(120))
{
count = i;
break;
}
shopText.Append("<div class='t2'><ul class='shopUlList'><li><div class='t1'></div><img width='200px' src='/photo/200/" + modelList[i].Photolist.img + "'/></li></ul></div>"); } shopText.Append("</div>");
}
}
我想在i为30 60 90 120的时候 跳到外面的for循环 但是我现在当i等于30的时候 跳出后i又被初始化成0了我想i继续往下走 就是i为31 这个怎么改 ?
解决方案 »
- 安装了VS2010 附带的sql2008不能使用?求解惑
- 报表绑定数据源
- 求助,关于项止施实时要求SQL2000 在远程无法访问,只能在服务器上访问!100分求解高手飞啊!
- Server.UrlEncode 怎么对url 中使用Eval("")进行编码?
- 请教一个表的设计
- 文件连接错误~~(怪问题,请教大家)!
- 如何点击一个按钮,让他实现ie的刷新功能?
- 菜鸟问题:一个Frame,有两个页面,在客户端可以通过脚本互相访问,但在服务器端怎么办?
- Message.text的什么?
- 如何在代码后置时设置背景音乐???
- 添加webservice,提示IP地址无效
- 求INstallshield高手,有偿求教
continue;结束本次循环
还有你这个Equals看起来真怪,用==吧,它只是值类型,能少写几个字符。int j = 0;
for (int i = j; i < modelList.Count; i++,j++)
{
if (i.Equals(30))
{
count = i;
break;
} if (i.Equals(60))
{
count = i;
break;
} if (i.Equals(90))
{
count = i;
break;
} if (i.Equals(120))
{
count = i;
break;
}
StringBuilder shopText = new StringBuilder();
List<Let.Model.ModelAllList> modelList = new Let.BLL.photoList().ExecuteReader(CommandType.StoredProcedure, "P_ShopList",
new SqlParameter("@startIndex", AspNetPager1.StartRecordIndex),
new SqlParameter("@endIndex", AspNetPager1.EndRecordIndex)); if (modelList.Count > 0)
{
int count = 0;
int j=0;
for (int n = 0; n < 4; n++)
{
shopText.Append("<div class='divlist'>"); for (int i = j; i < modelList.Count; i++)
{
if (i.Equals(30))
{
count = i;
j=31;
break;
} if (i.Equals(60))
{
count = i;
j=61;
break;
} if (i.Equals(90))
{
count = i;
j=91;
break;
} if (i.Equals(120))
{
count = i;
j=121;
break;
}
shopText.Append("<div class='t2'><ul class='shopUlList'><li><div class='t1'></div><img width='200px' src='/photo/200/" + modelList[i].Photolist.img + "'/></li></ul></div>"); } shopText.Append("</div>");
}
}
没测试,自己测试一下看看