Solved

ASP.net ListBox with check boxes

Posted on 2011-02-14
4
1,048 Views
Last Modified: 2012-06-27
Hi

In ASP.net 4 is there a ListBox control that contains check boxes within it?
How would I gather which items have been checked using VB.net.
I'd like to gather bith the index and the accompanying label
0
Comment
Question by:murbro
  • 2
4 Comments
 
LVL 10

Expert Comment

by:John Claes
Comment Utility
as Far as I remember the ListBox has a property Items.
Herein you'll find all Checkboxes.

You can loop through them by indexCounter
if checked ==> you have the index and the checkbox (so also the lable)

Regards
Poor Beggar
0
 
LVL 7

Accepted Solution

by:
mr_nadger earned 500 total points
Comment Utility
Use the CheckBoxList object, then iterate through the items list, I think the properties you want are:
i as the index (Starting at 0)
CheckBoxList.Items(i).Selected (=true or false)
CheckBoxList.Items(i).Text

Alternatively, if going from an onclick event, you have
CheckBoxList.SelectedIndex
CheckBoxList.SelectedItem.Text
CheckBoxList.SelectedItem.Selected


0
 
LVL 7

Expert Comment

by:mr_nadger
Comment Utility
oh, if you're going to remove items from the list programmatically, iterate backwards through the list to avoid index out of range errors
0
 

Author Closing Comment

by:murbro
Comment Utility
thanks very much
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now