JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the ListControl Class

The ListControl class is an abstract base class which supports the properties, methods, and events common for all list-type controls, including the ones we'll see in this chapter—checkbox lists and radio button lists. Here's the hierarchy of this class:


You can find the notable public properties of ListControl objects in Table 16.4 and their notable public events in Table 16.5. (This class has no non-inherited methods.) Note that as with other Web server controls, I am not listing the no-table properties, methods, and events this class inherits from the Control and WebControl classes—you can find them in Chapter 15, Tables 15.1 to 15.5.

Table 16.4: Noteworthy public properties of ListControl objects.




Gets/sets whether the page is posted back to the server when the user changes the list selection.


Gets the collection of items that are in this list control.


Gets/sets the index of the selected item in the list. If more than one item is selected, this value is the lowest selected index.


Gets the selected item in the list control. If more than one item is selected, this property holds the item with the lowest index.

Table 16.5: Noteworthy public events of ListControl objects.




Occurs when the list selection changes.

Note that the ListControl control's Items property returns a collection of ListItem objects that you can use to access an item in a list control. See the next topic for the details.


To add items to a control based on the ListControl class, you use the Items collection's Add method.

Related solution:

Found on page:

5Adding Items to List Boxes at Run Time


Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor