foreach(GridViewRow item in GridView1.Rows)
{
CheckBox cb =(CheckBox)item.FindControl("ck");
if (cb.Checked)
{
string id="";
id += item.Cells[2].Text;
}
}
选了3个还是只能得到一个
string id="";
foreach(GridViewRow item in GridView1.Rows)
{
CheckBox cb =(CheckBox)item.FindControl("ck");
if (cb.Checked)
{
id += item.Cells[2].Text;
}
}
string id 你放里面了 每次都是重新定义了