Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MIA Bound listbox selected property
Message
De
12/06/2006 12:56:52
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01128462
Message ID:
01128475
Vues:
25
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform