Guest User

Untitled

a guest
Jan 18th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.91 KB | None | 0 0
  1. Private Sub BuildTableTitulaire(ByVal Str_College As String)
  2.         Dim Row As TableRow 'TR = Ligne
  3.         Dim Cell As TableCell 'TD -> Cellule
  4.         Dim tblHead As TableHeaderCell 'Header
  5.         Dim PredicatListCount As Integer
  6.         Dim MaxCountListe As Integer
  7.         oF_EelecCandidatS.LoadByPoste("myBDD", oF_EelecCandidatS, "Titulaire")
  8.         oF_EelecCandidatS.LoadListeMax("myBDD", MaxCountListe, "Titulaire")
  9.  
  10.         Row = New TableRow ' Nouvelle Ligne
  11.         'Construction des entêtes du tableau :
  12.         For Each candidat As F_EelecCandidat In oF_EelecCandidatS
  13.             If (candidat.CAN_College = Str_College) Then
  14.                 If (Not LstCandidat.Contains(candidat.CAN_Liste)) Then
  15.                     LstCandidat.Add(candidat.CAN_Liste)
  16.                     tblHead = New TableHeaderCell
  17.                     tblHead.Text = "Liste " & candidat.CAN_Liste
  18.                     Row.Cells.Add(tblHead)
  19.                     InfosTable.Rows.Add(Row)
  20.                 End If
  21.             End If
  22.         Next
  23.  
  24.         'Dim Str_Machine As String = Environment.MachineName
  25.         'Dim Str_NameUserMachine As String = Environment.UserName
  26.         '______________________________________
  27.         Dim Indice As Integer = 0
  28.         For Index As Integer = 0 To LstCandidat.Count - 1 'Nombre de colonne crée
  29.             PredicatListCount = oF_EelecCandidatS.LongCount(Function(candidat) candidat.CAN_Liste = LstCandidat(Index))
  30.             For IndexRow As Integer = 0 To MaxCountListe 'Creation des lignes
  31.                 Row = New TableRow ' Nouvelle Ligne
  32.                 InfosTable.Rows.Add(Row)
  33.             Next
  34.  
  35.             For IndexRow As Integer = 1 To PredicatListCount 'Création des cellules dans les lignes
  36.                 If (Not oF_EelecCandidatS.ElementAtOrDefault(Indice) Is Nothing) Then
  37.                     Cell = New TableCell
  38.                     chkBox = New CheckBox
  39.                     chkBox.ID = oF_EelecCandidatS(Indice).CAN_Liste & IndexRow
  40.                     chkBox.InputAttributes.Add("Value", oF_EelecCandidatS(Indice).cbMarq)
  41.                     chkBox.Text = " " & oF_EelecCandidatS(Indice).CAN_Nom & " " & oF_EelecCandidatS(Indice).CAN_Prenom & " Liste : " & oF_EelecCandidatS(Indice).CAN_Liste
  42.                     chkBox.AutoPostBack = True
  43.                     AddHandler chkBox.CheckedChanged, AddressOf CheckedChanged
  44.                     Cell.Controls.Add(chkBox)
  45.                     InfosTable.Rows(IndexRow).Cells.Add(Cell)
  46.                     Indice += 1
  47.                     If (IndexRow = PredicatListCount And IndexRow < MaxCountListe) Then
  48.                         For IndexTest As Integer = IndexRow + 1 To MaxCountListe
  49.                             Cell = New TableCell
  50.                             InfosTable.Rows(IndexTest).Cells.Add(Cell)
  51.                         Next
  52.                     End If
  53.                 End If
  54.             Next
  55.         Next
  56.  
  57.     End Sub
Add Comment
Please, Sign In to add comment