【发布时间】:2020-05-27 16:03:20
【问题描述】:
我有这样的模型
public Nullable<bool> Space { get; set; }
public Nullable<bool> Lab { get; set; }
public Nullable<bool> Consultation { get; set; }
public Nullable<bool> Financial { get; set; }
public Nullable<bool> Other { get; set; }
在我看来,我初始化了复选框,你可以在这里看到:
@Html.CheckBoxFor(model => model.Space.Value, new { id = "CheckSpace" })
@Html.CheckBoxFor(model => model.Lab.Value, new { id = "CheckLab" })
@Html.CheckBoxFor(model => model.Consultation.Value, new { id = "CheckConsultation"})
@Html.CheckBoxFor(model => model.Financial.Value, new { id = "CheckFinancial" })
@Html.CheckBoxFor(model => model.Other.Value, new { id = "CheckOther" })
但是当我将视图发布到我的控制器时,所有复选框的值都是空的,你能帮忙吗?
【问题讨论】:
-
复选框是否被选中?
标签: c# asp.net-mvc asp.net-mvc-4 checkbox