You can use the SELECT control to present a predefined list to the user. The SELECT control is useful for quickly selecting one or more items from a predefined or dynamically generated list from the database. You can implement the SELECT control in different ways, including a drop-down list, a list box, or a multi-select list box. These use a combination of SIZE and MULTIPLE attributes.
To populate the control, you use the OPTION object. To get hold of the selected value(s), you need the reference of the control and the selected option. To retrieve the selected value, you use the SelectedIndex property with the options collection to identify the particular item.
In order to retrieve the selected values from a multi-select list, you need to iterate through all the options. The selected property can be queried to determine if the option is selected. If so, you can use the current index of the iteration to acquire the text or value of the item.
When a multi-select list is submitted, the items are sent as a comma-delimited list. If a VALUE attribute is not provided as an option, the TEXT attribute is sent instead.
SELECT ID="CityList" SIZE="2">
Multi-select list box
SELECT ID="CityList" SIZE="3" MULTIPLE>