我想获取GRIDVIEW控件中插入CHECKBOX控件中的一个值
int intCount = this.GridView1.Rows.Count;
for (int i = 0; i < intCount; i++)
{
CheckBox CheckBox1 = this.GridView1.Rows[i].Cells[5].FindControl("CheckBox1") as CheckBox;
if (CheckBox1.Checked)
{
string title =this.GridView1.Rows[i].Cells[1].Text;
SqlWebDal swd = new SqlWebDal();
string sqlcontent = "UPDATE Tips SET Release ='true' WHERE Title='" + title + "'";
swd.GetSqlCmd(sqlcontent);
}
}
Response.Write("<script language='javascript'>alert('发布成功')</script>");
Response.Write();
------解决方案--------------------
Checkbox test =(CheckBox)GridView1.rows[i].FindControls("yourControlName");
string title = test.Checked.toString()