Using the Items Collection
All the list items rendered by a List control are contained in the List control’s list item collection. This collection is exposed by the Items
property.
You can work directly with the list items in this collection. For example, you can add or remove particular list items, or you can change the order of the list items.
The page in Listing 10.8 contains two ListBox
controls and two button controls. When you click the Add button, a list item is moved from the first ListBox
to the second ListBox
control. When you click Remove, the list item is moved back to the original List control (see Figure 10.7).
Figure 10.7. Using the ListPicker
to select list items.
Listing 10.8. ListPicker.aspx
The first ListBox
in Listing ...
Get ASP.NET 4 Unleashed 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.