Mohsen Shabanian
Mohsen Shabanian
html select from enum in netcore

html select from enum in netcore

05 March, 2020

it's easy. just use GetEnumSelectList html helper.

<select asp-for="Property.PropertyType" asp-items="Html.GetEnumSelectList<PropertyType>()" class="form-control">
  <option selected></option>
</select>