如何在.net mvc中禁用模型视图复选框?
我尝试使用语法: new { disabled = "disabled“},但不起作用。
<div class="col-sm-7 checkbox-inline text-left">
<label style="margin-right:15px"></label>
@Html.CheckBoxFor(model => model.Email, new { disabled = "disabled" } ) <label class="hthin" asp-for="Email" style="margin-right:30px"></label>
@Html.CheckBoxFor(model => model.Pager, new { disabled = "disabled" }) <label class="hthin" asp-for="Pager" style="margin-right:30px"></label>
@Html.CheckBoxFor(model => model.Landline, new { disabled = "disabled" }) <label class="hthin" asp-for="Landline" style="margin-right:30px"></label>
</div>
发布于 2018-08-17 22:12:05
@Html.CheckBoxFor() -模型对象属性应为布尔值。
谢谢斯蒂芬·米克。我更新了答案。@ symbol用于保留关键字。例如@class。
谢谢,GregH。你接得很好。
https://stackoverflow.com/questions/51897025
复制相似问题