Checkboxlist

  • Thread starter Thread starter DaveF
  • Start date Start date
Hi Dave,

Just iterate through the items and test them. Here's some code:

Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Dim itm As ListItem
For Each itm In CheckBoxList1.Items
If itm.Selected = True Then
Response.Write(itm.Value & "<br>")
End If
Next
End Sub

<form id="Form1" method="post" runat="server">
<asp:CheckBoxList id="CheckBoxList1" runat="server">
<asp:ListItem Value="Red">Red</asp:ListItem>
<asp:ListItem Value="Blue">Blue</asp:ListItem>
<asp:ListItem Value="Green">Green</asp:ListItem>
</asp:CheckBoxList>

<P>&nbsp;</P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
</form>

Does this help?

Ken
Microsoft MVP [ASP.NET]
 
Back
Top