【发布时间】:2019-04-04 07:20:32
【问题描述】:
这里我使用了两个复选框
<label asp-for="SendReport" class="checkbox-inline"><input type="checkbox" asp-for="SendReport" />Send Report</label><br>
<label asp-for="SendInvoice" class="checkbox-inline"><input type="checkbox" asp-for="SendInvoice" />Send Invoice</label><br>
两个 cheboc 的数据类型,即 asp-for="SendReport" and asp-for="SendInvoice" 是 bit。
现在的问题是,当我尝试加载页面时,它会抛出如下错误
Unexpected 'asp-for' expression result type 'System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' for <input>. 'asp-for' must be of type 'System.Boolean' or 'System.String' that can be parsed as a 'System.Boolean' if 'type' is 'checkbox'.<br>
任何帮助将由衷感谢。谢谢
【问题讨论】:
-
有什么理由将
bit field绑定到checkbox?checkbox被true或false绑定,你是如何决定何时检查checkbox和bit的?bit field的值是多少?
标签: c# asp.net-core-2.0 razor-pages