Select-将 Helper .NET Core 标记为控制器

Select-Tag Helper .NET Core to Controller

我尝试使用 'submit' 按钮提交标签-select 并且它工作正常但是没有提交按钮怎么样?

我想在没有javascript的情况下每次更改时直接将tag-select的值发送给控制器。这可能吗?

@model MyViewModel
<form asp-controller="Home" asp-action="Create">
    <select asp-for="EmployeeId" asp-items="@(new SelectList(Model.EmployeesList,"Id","FullName"))">
        <option>Please select one</option>
    </select>
</form>


[HttpPost]
public IActionResult Create(MyViewModel model)
{
    //check model.EmployeeId 
    //to do : Save and redirect
}

试试这个:

<select asp-for="EmployeeId" asp-items="@(new SelectList(Model.EmployeesList,"Id","FullName"))" onchange="this.form.submit()">
    ...
</select>