L'événement commandrow supprimer dans gridview
Bonjour,
Est-ce que quelqu'un parmi vous a travaillé sur la suppression dans gridview (l'événement commandrow) en asp ? Merci
J'ai procédé comme suit mais il ne marche pas. :cry::cry::cry:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
protected void GridView1_RowCommand2(object sender, GridViewCommandEventArgs e)
{
try
{
GLB.con.Open();
if (e.CommandName == "supprimer")
{
int num = Convert.ToInt32(e.CommandArgument);
GLB.com.CommandText = "delete from Agence_fournisseur where id_agence="+GridView1.Rows[num].Cells[0];
GLB.com.ExecuteNonQuery();
}
}
catch (SqlException x)
{
Response.Write("erreur" + x.Message);
}
catch (Exception p)
{
Response.Write("erreur" + p.Message); }
finally
{
if (GLB.con.State == ConnectionState.Open)
GLB.con.Close();
}
} |