Working with the Items Collection
The Items collection is a special property of type ListItemCollection in the System.Web.UI.WebControls namespace and is shared by all ASP.NET list controls. This class does the grunt work in managing the list items for each list control. Table 6.2 shows a summary of the properties and methods for the ListItemCollection class. Please take a moment to review them before we move on with an example of manipulating the items in a list control programmatically.
Name | Item | Description |
---|---|---|
Add | Method | Overloaded. Adds a new item to the collection by supplying either a ListItem object or string value |
All | Property | Gets an array of type ListItem |
Get ASP.NET by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.