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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| Private Sub GenererTableCommande()
Dim lst As List(Of stCommande) = PropListeCommande
Dim tb As New Table()
Dim headR As New TableRow()
Dim hCell1, hCell2, hCell3, hCell4 As New TableCell
hCell1.Text = "Titre Article"
hCell2.Text = "Quantité"
hCell3.Text = "Taille"
hCell4.Text = ""
headR.Cells.Add(hCell1)
headR.Cells.Add(hCell2)
headR.Cells.Add(hCell3)
headR.Cells.Add(hCell4)
tb.Rows.Add(headR)
For Each o As stCommande In lst
Dim row As New TableRow()
Dim cell1 As New TableCell()
Dim cell2 As New TableCell()
Dim cell3 As New TableCell()
Dim cell4 As New TableCell()
Dim link As New Button()
link.Text = "supprimer"
AddHandler link.Click, AddressOf BoutonTableau_OnClick
cell1.Text = o.NomArticle.ToString()
cell2.Text = o.Quantite.ToString()
cell3.Text = o.IdTaille.ToString()
cell4.Controls.Add(link)
row.Cells.Add(cell1)
row.Cells.Add(cell2)
row.Cells.Add(cell3)
row.Cells.Add(cell4)
tb.Rows.Add(row)
Next
phPanier.Controls.Add(tb)
End Sub
Private Sub BoutonTableau_OnClick(sender As Object, e As EventArgs)
Dim btn As Button = DirectCast(sender, Button)
'...
End Sub
Private Sub deleteArticle(ByVal pIdArticle As Decimal)
Dim lst As List(Of stCommande) = PropListeCommande
For Each o As stCommande In lst
pIdArticle = o.IdArticle.ToString()
If (pIdArticle = o.IdArticle.ToString()) Then
lst.Remove(o)
Exit For
End If
Next
'...
End Sub |
Partager