日期:2014-05-20  浏览次数:20418 次

如何遍历Gridview中的Checkbox呢?检查被选中的checkbox的值呢?
如何遍历Gridview中的Checkbox呢?检查被选中的checkbox的值呢?

------解决方案--------------------
protected void btnDel_Click(object sender, EventArgs e)
{
int intRowCount = this.GridView1.Rows.Count;
string strInfo = string.Empty;

for (int i = 0; i < intRowCount; i++)
{
CheckBox chk = (CheckBox) this.GridView1.Rows[i].Cells[0].FindControl( "chkDelete ");
if (chk.Checked)
{
this.GridView1.Rows[i].Visible = false;
strInfo += this.GridView1.Rows[i].Cells[1].Text + "被选中. " + " <br> ";
}
}

this.lblInfo.Text = strInfo;
}