Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do I select more than one value from checkboxlist?

Status
Not open for further replies.

Ken011

MIS
Oct 13, 2006
66
US
Greetings all again,

I have a checkboxlist control shown below:

Code:
						<td>					<asp:checkboxlist id="txtservice" runat="server" RepeatDirection="Horizontal" repeatcolumns="6">
													<asp:ListItem Value="Seagull" Selected="False">Seagull</asp:ListItem>
													<asp:ListItem Value="Email">Email</asp:ListItem>
													<asp:ListItem Value="Mainframe">Mainframe</asp:ListItem>
													<asp:ListItem Value="Cubis">Cubis</asp:ListItem>
													<asp:ListItem Value="Banner">Banner</asp:ListItem>
													<asp:ListItem Value="JDL">JDL</asp:ListItem>
													<asp:ListItem Value="Tiburon">OTiburon</asp:ListItem>
													<asp:ListItem Value="iasWorld">iasWorld</asp:ListItem>
													<asp:ListItem Value="Notary">Notary</asp:ListItem>
													<asp:ListItem Value="VPN">VPN</asp:ListItem>
													<asp:ListItem Value="VPSPagecenter">VPS-Pagecenter</asp:ListItem>
													<asp:ListItem Value="PCDOC">PC DOC</asp:ListItem>
												</asp:checkboxlist>

When I check more than one checkboxes, and click submit, only 1 value gets selected and submitted.

How do I ensure that all checkboxes that I checked get selected?

Thanks for all the help.
 
When I check more than one checkboxes, and click submit, only 1 value gets selected and submitted.
I'd be very surprised if that was the case. It's more likely that you are reading what was submitted incorrectly. Try looping through the items to see which ones were selected e.g.
Code:
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each li As ListItem In txtservice.Items
            If li.Selected = True Then Response.Write(li.Text)
        Next
    End Sub


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top