Solved

ASP.net ListBox with check boxes

Posted on 2011-02-14
4
1,055 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
[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:murbro
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

Suggested Solutions

Title # Comments Views Activity
asp Google Map 2 92
checkbox group not updating when none of them is selected 11 45
Create a Dropdown list with sub group 10 43
Disable the weekends on datepicker control 6 52
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

739 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