A select element lets a form present options for selection. In Razor, the Select Tag Helper can render a drop-down, list box, multiselect control, or grouped options. section 18.2.4
A Razor PageModel supplies two kinds of properties:
- An option collection containing SelectListItem objects with Value and Text properties. section 18.2.4
- A selected-value property for one choice, or an IEnumerable property for multiple choices. section 18.2.4
- The asp-for attribute binds the selection, while asp-items supplies the displayed options. section 18.2.4
Three common forms
Use <select asp-for="Input.SelectedValue1" asp-items="Model.Items"></select> for a drop-down. Add size="4" for a single-select list box, or bind asp-for to Input.MultiValues for multiselect behavior. Add SelectListGroup values to create optgroup elements. Include an option with an empty value, such as **Not selected**, when no choice should be selected by default.









