I have GridView and checkboxes, while select check box and click on button then row should be hide.
namespace Plant_Enrty_system
{
public partial class cisf_approv : System.Web.UI.Page
{
protected void button_Click(object sender, EventArgs e)
{
string pass_id = string.Empty;
DataTable dt = new DataTable();
try
{
foreach (GridViewRow row in GridView1.Rows)
{
pass_id = Convert.ToString(GridView1.DataKeys[row.RowIndex].Value);
CheckBox cb = (CheckBox)row.FindControl("chkSelect");
if (cb.Checked)
{
string cisf_flag = cb.Checked ? "Y" : "N";
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
SqlCommand cmd = new SqlCommand("UPDATE Customers SET cisf_flag = @cisf_flag where pass_id=@pass_id");
cmd.Connection = con;
cmd.Parameters.AddWithValue("@cisf_flag", cisf_flag);
cmd.Parameters.AddWithValue("@pass_id", pass_id);
con.Open();
string isUpdated = Convert.ToString(cmd.ExecuteNonQuery());
con.Close();
}
}
}
}
catch (Exception ex)
{
Response.Write("Error occured: " + ex.Message.ToString());
}
finally
{
pass_id = string.Empty;
}
System.Threading.Thread.Sleep(8000);
}
}
}