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 30 31 32 33
| /// <summary>
/// Suppression des éléments
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lkbnSupprimer_Click(object sender, EventArgs e)
{
// Recupère les lignes cochées
List<GridViewRow> rowSuppr = Utilitaire.GridViewHelper.GetCheckedRows(this.GridView1, (int)ColonnesEnum.Supprimer);
// Si il n'y a rien à supprimer
if (rowSuppr == null || rowSuppr.Count <= 0)
return;
// Récupère les informations utile pour la suppression
// ID = couple de valeur (ID Principal + ID Secondaire)
List<KeyValuePair<int, int>> aSupprimer = new List<KeyValuePair<int, int>>();
foreach (GridViewRow grv in rowSuppr)
{
// ??? La propriété .Text ne contient pas ma donnée
int idPrincipal = grv.Cells[(int)colonnesEnum.IDPrincipal].Text;
// ??? La propriété .Text ne contient pas ma donnée
int idSecondaire = grv.Cells[(int)colonnesEnum.IDSecondaire].Text;
KeyValuePair<int,int> element = new KeyValuePair<int,int>(idPrincipal,idSecondaire);
aSupprimer.Add(element);
}
// Appel du service
Exception exception = null;
Services.Supprimer(aSupprimer, exception);
} |
Partager