JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the ListBox Class

As in Windows forms, you use Web server list boxes to display a list of items the user can select from. Here's the inheritance hierarchy for the ListBox class:


As discussed in the In Depth section of this chapter, you can create both single-selection and multiple-selection list boxes.

You can find the notable public properties of ListBox objects in Table 17.4. (This class has no non-inherited methods or events.) Note that as with other Web server controls, I am not listing the notable 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. This class inherits the ListControl class, and you can find the notable public properties of ListControl objects in Chapter 16, Table 16.4, and their notable public events in Table 16.5. (The ListControl class has no non-inherited methods.) Note that the ListControl class's Items property returns a collection of ListItem objects which you can use to access an item in a list box. You can find the notable public properties of ListItem objects in Table 16.6. (The ListItem class has no non-inherited methods or events.)

Table 17.4: Noteworthy public properties of ListBox objects.




Gets/sets the number of rows in the list box.


Gets/sets the list box's selection mode: single or multiple.


Gets/sets the tool tip text for this list box.


Don't forget—if you want to handle this control's events immediately, you must set its AutoPostBack property to True.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor