protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = GridView1.Rows[e.RowIndex];
string constr = ConfigurationManager.ConnectionStrings["connstr"].ToString();
SqlConnection con = new SqlConnection(constr);
string id = (((Label)row.FindControl("lblid")).Text).ToString();
string comments = (((TextBox)row.FindControl("txtcomments")).Text).ToString();
if (((CheckBox)row.FindControl("CheckBox1")).Checked == true)
{
con.Open();
SqlCommand CmdSql = new SqlCommand("Update leave set admin_comments='" + comments + "', granted='" + true + "' where id=" + id + " ", con);
CmdSql.ExecuteNonQuery();
GridView1.EditIndex = -1;
con.Close();
gridpop();
}
else
{
con.Open();
SqlCommand CmdSql = new SqlCommand("Update leave set admin_comments='" + comments + "', granted='" + false + "' where id=" + id + " ", con);
CmdSql.ExecuteNonQuery();
GridView1.EditIndex = -1;
con.Close();
gridpop();
}
}