Solved

ASP.net ListBox with check boxes

Posted on 2011-02-14
4
1,057 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Suggested Courses

617 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