How to: Set Web Server Control Properties in Collections
The properties of some Web server controls are not simple values or objects, but collections. For example, the individual values of aWeb server control are implemented as a collection of objects.
To set a collection-based control property
Instantiate the item you want to use, and then add it to the control's collection.
The following code example shows how to add a ListItem object to a ListBox control by adding it to the control'scollection. In the first example, the item is explicitly created before being added. In the second example, items are created and added at the same time.