Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MIA Bound listbox selected property
Message
From
12/06/2006 12:56:52
 
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01128462
Message ID:
01128475
Views:
22
This message has been marked as the solution to the initial question of the thread.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform