Present Lists Using the SELECT Control

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.

Drop-down list

 SELECT ID="CityList">

List box

 SELECT ID="CityList" SIZE="2">

Multi-select list box

 SELECT ID="CityList" SIZE="3" MULTIPLE>
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

Top 5 B2B SaaS Marketing Agencies for 2023

In recent years, the software-as-a-service (SaaS) sector has experienced exponential growth as more and more companies choose cloud-based solutions. Any SaaS company hoping to stay ahead of the curve in this quickly changing industry needs to invest in effective marketing. So selecting the best marketing agency can mean the difference

technology leadership

Why the World Needs More Technology Leadership

As a fact, technology has touched every single aspect of our lives. And there are some technology giants in today’s world which have been frequently opined to have a strong influence on recent overall technological influence. Moreover, those tech giants have popular technology leaders leading the companies toward achieving greatness.

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.