I want to update a row which I have checked and reload the gridview again.
I update it using a button and a checkbox for selecting the row.
protected void btnProceed_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chkRow = (row.Cells[0].FindControl("chkRow") as CheckBox);
if (chkRow.Checked)
{
con.Open();
cmd = new SqlCommand(@"UPDATE JobQuotations1
SET TransactionStatus = @Done
WHERE TransactionID = @Tid
AND TransactionNum = @num", con);
cmd.Parameters.AddWithValue("@Done", "Done");
cmd.Parameters.AddWithValue("@Tid", GridView1.SelectedRow.Cells[1].ToString());
cmd.Parameters.AddWithValue("@num", GridView1.SelectedRow.Cells[2].ToString());
cmd.ExecuteNonQuery();
con.Close();
LoadDataGrid();
}
}
}
When I clicked the button nothing is happening.
