I know this cause it just came up last week. You need to set the "AppendDataBoundItem" property to true.
>This code works as is.
But when you add a datasource to the list the selected property no longer represents the UI on the web page. Short of rolling a loop that fills the list from the data collection how can I get the items that are selected in the list on the page? (this behaviour is the same in a regular listbox as well as the checklistbox)
>html src:
><asp:CheckBoxList ID="cblUsers" runat="server" >
> <asp:ListItem>Item 1</asp:ListItem><asp:ListItem>Item 2</asp:ListItem>
> <asp:ListItem>Item 3</asp:ListItem><asp:ListItem>Item 4</asp:ListItem>
></asp:CheckBoxList>
>
>code behind:
> With cblUsers
> For x = 0 To .Items.Count - 1
> If .Items(x).Selected Then
> Response.Write(.Items(x).Text & "<BR>")
> End If
> Next
> End With
>
>
>
>My humble thanks in advance,
(On an infant's shirt): Already smarter than Bush