• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

Remove an item from an asp.net checkbox list at run time

Is it possible to remove a check box item from a checkbox list at run time?  I've tried using the Remove method of the check list controls collection object, but the Remove method expects a Control object type rather than a List Item object.  I also tried using the syntax: Controls.Remove(.Controls(index)) which did not work. I'm using asp.net v.2003 with VB.Net.
0
LloydMc
Asked:
LloydMc
  • 2
1 Solution
 
nayernaguibCommented:
You can use:

  CheckBoxList1.Items.Remove(ListItem) or
  CheckBoxList1.Items.Remove(string)

________________

  Nayer Naguib
0
 
nayernaguibCommented:
Examples:

  CheckBoxList1.Items.Remove(CheckBoxList1.Items(1)) 'removes the 2nd item
  CheckBoxList1.Items.Remove("Hello")                         'removes the item with text "Hello"

_______________

  Nayer Naguib
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now