RadioButtonFor绑定值

时间:2024-04-11 11:04:43
<div class="form-group">
<label class="control-label col-md-2">是否</label>
<div class="col-md-10">
@Html.RadioButtonFor(model => model.IsRecord, "0", new { @id = "Mode0", @name = "Mode", @value = "0", @checked = (Model.IsRecord == "0" ? "checked" : "") }) 否
@Html.RadioButtonFor(model => model.IsRecord, "1", new { @id = "Mode1", @name = "Mode", @value = "1" , @checked = (Model.IsRecord == "1" ? "checked" : "") }) 是 </div>
</div>