<select required>
@for (int i = 0; i < @ViewBag.screenList.Count; i++) {
<option value="@i">@ViewBag.screenList[i]</option>
}
</select>
<form asp-controller="Patients" asp-action="Details">
<select required onchange="this.form.submit()" name="screenData">
@for (int i = 0; i < @ViewBag.screenList.Count; i++) {
if (@ViewBag.screenList[i] == ViewBag.screenData) {
<option value="@ViewBag.screenList[i]" selected>@ViewBag.screenList[i]</option>
} else { <option value="@ViewBag.screenList[i]">@ViewBag.screenList[i]</option> }
}
</select>
</form>
const select = document.getElementById("select");
select.addEventListener("change", function(e) {
console.log("value", e.target.value);
});