【发布时间】:2018-10-01 12:48:57
【问题描述】:
注意:这个问题是关于 Blazor (0.2.1) 的预发布版本。
所以我一直陷于试图在选择下拉值的变化时获得一个简单的onchange来开火。像这样:
<select class="form-control d-flex" onchange="(dostuff())">
@foreach (var template in templatestate.templates)
{
<option value=@template.Name>@template.Name</option>
}
</select>
使用被调用的方法:
void dostuff()
{
Console.WriteLine("first spot is firing");
_template = templatestate.templates.FirstOrDefault(x => x.Name ==
_template.Name);
Console.WriteLine("second spot is firing");
}
无论我如何尝试重新定位它,我得到的结果都是浏览器中的这个错误。
Uncaught Error: System.ArgumentException: There is no event handler with ID 0
我缺少什么明显和关键的东西吗?因为我有一个按钮 onclick 事件在同一页面上运行得很好。
【问题讨论】:
-
您使用的 blazor 版本,0.1.0 或 0.2.0
-
我使用的是 0.2.1
标签: c# asp.net-core blazor