Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MIA Bound listbox selected property
Message
From
12/06/2006 12:06:22
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
MIA Bound listbox selected property
Miscellaneous
Thread ID:
01128462
Message ID:
01128462
Views:
69
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,
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Next
Reply
Map
View

Click here to load this message in the networking platform