Hai ,
I placed on checkbox inside the datagrid. I am having one database, having one table, have the field name confirm_field. In the confirm_field datatype is bit. I need to update the confirm_field field from the asp.net web page. I expect, if i checked the checkbox in datagrid, I need to update the database confirm_field, checked row value to true, other wise unchecked it will be false. Please give a solution.
Regards,
Manu.
Loading
Syed ShakeerPosted May 21, 2010, 2:20 AM
protected void buttton_Click(object sender, EventArgs e)
{
for (int i = 0; i < Gridview1.Rows.Count; i++)
{
CheckBox chkb = (CheckBox)Gridview1.Rows[i].Cells[0].FindControl("confirm_field");
if (chkb.Checked)
{
SqlCommand cmd=new SqlCommand("write here update command for true",conn);
cmd.ExecuteNonQuery();
}
else
{
SqlCommand cmd1=new SqlCommand("write here update command for false",conn);
cmd1.ExecuteNonQuery();
}
}
}