ASP.NET将Gridview中Checkbox选择的值插入数据库,一次insert都好几条数据.
for(inti=0;i<=GridView1.Rows.Count-1;){stringda=this.GridView1.Rows[i].Cells[1].Text;...
for (int i = 0; i <= GridView1.Rows.Count-1;)
{
string da = this.GridView1.Rows[i].Cells[1].Text;
foreach (GridViewRow item in GridView1.Rows)
{
if (((CheckBox)item.FindControl("CheckBox1")).Checked == true)
{
Response.Write("<script>alert('" + da + "')</script>");
}
}
有啥办法可以不插入(count-1)条数据?每次insert都一下好几条 展开
{
string da = this.GridView1.Rows[i].Cells[1].Text;
foreach (GridViewRow item in GridView1.Rows)
{
if (((CheckBox)item.FindControl("CheckBox1")).Checked == true)
{
Response.Write("<script>alert('" + da + "')</script>");
}
}
有啥办法可以不插入(count-1)条数据?每次insert都一下好几条 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询