asp.net.ph

ListItemCollection Class

System.Web.UI.WebControls Namespace


Represents the collection of Items in a ListControl.

ListItemCollection Class Members

Collapse   Constructors

Visibility Constructor Parameters
public ListItemCollection ( )

Collapse   Properties

Visibility Name Value Type Accessibility
public Capacity Int32 [ Get , Set ]
public Count Int32 [ Get ]
public IsReadOnly Boolean [ Get ]
public IsSynchronized Boolean [ Get ]
public Item ( Int32 index ) ListItem [ Get ]
public SyncRoot Object [ Get ]

Collapse   Methods

Visibility Name Parameters Return Type
public Add ( ListItem item ) Void
public Add ( String item ) Void
public AddRange ( ListItem items ) Void
public Clear ( ) Void
public Contains ( ListItem item ) Boolean
public CopyTo ( Array array , Int32 index ) Void
public FindByText ( String text ) ListItem
public FindByValue ( String value ) ListItem
public GetEnumerator ( ) IEnumerator
public IndexOf ( ListItem item ) Int32
public Insert ( Int32 index , ListItem item ) Void
public Insert ( Int32 index , String item ) Void
public Remove ( String item ) Void
public Remove ( ListItem item ) Void
public RemoveAt ( Int32 index ) Void

The ListItemCollection class represents a collection of ListItem objects. The ListItem objects, in turn, represent the items displayed in list controls, such as the ListBox. To programmatically retrieve ListItem objects from a list control, use one of following methods:

  • Use the indexer to get a single ListItem from the collection, using array notation.
  • Use the CopyTo method to copy the contents of the collection to a System.Array object, which can then be used to get items from the collection.
  • Use the GetEnumerator method to create a System.Collections.IEnumerator implemented object, which can then be used to get items from the collection.

The Count property specifies the total number of items in the collection, and is commonly used to determine the upper bound of the collection. You can add and remove items from the collection by using the Add and Remove methods.

See Also

ListControl.Items Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph