[C#]Comment recupérer la valeur d'un champ non visible d'un gridview dans un evenement GridView1_RowDeleting
Bonjour,
Tout est dans le titre, lorsque je passe la colonne Id_Categories en visible, ca marche bien. Lorsque la colonne en question est invisible, GridView1.Rows[e.RowIndex].Cells[0].Text ne me renvoie rien.
Pouvez-vous m'aider svp ? je suis débutant en asp net.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlConnection conDotNet = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ConnectionString);
SqlCommand MySqlCommand = new SqlCommand();
conDotNet.Open();
MySqlCommand.Connection = conDotNet;
MySqlCommand.CommandType = CommandType.Text;
MySqlCommand.CommandText = "UPDATE [T_CORRESPONDANCE] SET [Id_Categories] = '40' WHERE [Id_Categories] = '" + GridView1.Rows[e.RowIndex].Cells[0].Text + "'";
MySqlCommand.ExecuteNonQuery();
conDotNet.Close();
} |
Merci :)