我正在尝试实现一种图片选择形式,我希望在代码添加的每张图片旁边都有一个复选框,我希望循环中的每个复选框都有不同的ID。我试图在第二个for
循环中插入复选框(迭代数据表中的每个图片)。
这是我的代码:
string d = (string)Session["gouser"];
DataTable l = DAL.SelectFromTable(" Select * FROM [ClothesCatig] WHERE [UserID]='" + d + "'");
for (int i = 0; i < l.Rows.Count; i++)
{
DataTable m = DAL.SelectFromTable(" Select * FROM [Closet] WHERE [UserID]='" + d + "' and [catig]='" + l.Rows[i][2].ToString() + "'");
if (m.Rows.Count > 0)
{
Response.Write("<center><div class='container12'>");
Response.Write("<h4 class='ch'style='background-color: #985216;'>" + l.Rows[i][2] + "</h4>");
Response.Write("<table class='table1'><tr>");
for (int j = 0; j < m.Rows.Count; j++)
{
Response.Write("<td><center><img src='images/hanger.png'/ width='80px'/> </br><img src='Cloth/"
+ m.Rows[j][5].ToString() + "' width='80px'/></center></td>");
}
Response.Write("</table></tr>");
Response.Write("</div></center>");
}
}