Probleme sur une CheckBoxList
Bonjour
J'ai une CheckBoxList et je voudrais savoir les CheckBox cochées quand je clic sur un bouton
ma CheckBoxList :
Code:
1 2 3 4 5 6 7 8 9
| <asp:CheckBoxList ID="CbxHeures" runat="server"
AutoPostBack="True" RepeatDirection="Horizontal">
<asp:ListItem Value="8">8h</asp:ListItem>
<asp:ListItem Value="9">9h</asp:ListItem>
<asp:ListItem Value="10">10h</asp:ListItem>
<asp:ListItem Value="11">11h</asp:ListItem>
<asp:ListItem Value="12">12h</asp:ListItem>
<asp:ListItem Value="13">13h</asp:ListItem>
</asp:CheckBoxList> |
Mon bouton :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| Sub btnHeureOK_onclick(ByVal Sender As Object, ByVal e As EventArgs)
Dim I As Integer
For I = 0 To CbxHeures.Items.Count - 1
If CbxHeures.Items(I).Selected Then
Dim H_OK As String = CbxHeures.Items(I).Selected.ToString
If H_OK = "true" Then
lblH_OK.Text = "Sélectionné"
Else
lblH_OK.Text = "Non sélectionné"
End If
End If
Next
End Sub |
Quand je clic sur mon bouton j'ai non-selectionné que la CheckBox soit cochées ou non
Pouvez-vous me dire où est l'erreur
Merci