我需要能够在<select>. 问题是我也绑定了@bind,当我尝试使用@onchange 时出现错误,指出@bind 已经在使用它。我尝试使用@onselectionchange,但这没有任何作用(不运行该功能)。我可以忘记@bind 而只是将@onchange 分配给一个函数,但我不确定如何将选定的值传递给该函数。
我有以下代码:
<select @bind="@SelectedCustID" @ @onchange="@CustChanged" class="form-control">
@foreach (KeyGuidPair i in CustList)
{
<option value="@i.Value">@i.Text</option>
}
</select>
Run Code Online (Sandbox Code Playgroud)
谢谢。