?
Solved

ASP.net ListBox with check boxes

Posted on 2011-02-14
4
Medium Priority
?
1,058 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:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 10

Expert Comment

by:John Claes
ID: 34886712
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 2000 total points
ID: 34895796
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
ID: 34895820
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:Murray Brown
ID: 34914920
thanks very much
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

719 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