Try something like
If the ID field is the PrimaryKey , set it to the
DataKeyNames property of the Gridview.
Then in the
RowUpdating event you can try to access like
string ID= GridView1.DataKeys[e.RowIndex].Values["ID"].ToString();
SqlConnection con = new SqlConnection("YourConnectionString");
string query="UPDATE TableName set fieldName=@Parameter where Id=@ID";
con.Open();
SqlCommand Cmd = new SqlCommand(query, con);
Cmd.Parameters.AddWithValue("@ID", ID);
Cmd.ExecuteNonQuery();
GridView1.DataBind();