Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MIA Bound listbox selected property
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
MIA Bound listbox selected property
Divers
Thread ID:
01128462
Message ID:
01128462
Vues:
75
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

Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform