Since your comments don't match the names of the variables to which you are assigning, I'd guess that you're putting the wrong values into your update statement. (See
**MISMATCH** comments below!)
Also, your where clause is wrong. You aren't using the ID value from the row of the GridView.
I don't see the SqlCommand you construct actually being executed!
Your code is vulnerable to
SQL injection[
^].
It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database.
NEVER use string concatenation to build a SQL query.
ALWAYS use a parameterized query. Something like:
TableCellCollection theRowCells = GridView1.Rows[e.RowIndex].Cells;
string ID = theRowCells[0].Text;
string Name = ((TextBox)theRowCells[1].Controls[0]).Text;
string Address = ((TextBox)theRowCells[2].Controls[0]).Text;
string Gender = ((RadioButtonList)theRowCells[3].Controls[0]).Text;
string Country = ((DropDownList)theRowCells[4].Controls[0]).Text;
string State = ((DropDownList)theRowCells[5].Controls[0]).Text;
string City = ((DropDownList)theRowCells[5].Controls[0]).Text;
using (SqlCommand cmd = new SqlCommand("UPDATE SubmitData SET Name=@NAME, Address=@ADR, Gender=@G, Country=@CNTRY, State=@ST, City=@CITY where ID = @ID", con))
{
cmd.Parameters.AddWithValue("@NAME", Name);
cmd.Parameters.AddWithValue("@ADR", Address);
cmd.Parameters.AddWithValue("@G", Gender);
cmd.Parameters.AddWithValue("@CNTRY", Country);
cmd.Parameters.AddWithValue("@ST", State);
cmd.Parameters.AddWithValue("@CITY", City);
cmd.Parameters.AddWithValue("@ID", ID);
con.Open();
cmd.ExecuteNonQuery();
}