取决于单选按钮选择的两种不同模型;将文本绑定到所选的true / false值

时间:2019-06-04 17:18:27

标签: javascript c# asp.net razor

我正在使用asp.net剃须刀(旧版本,代码使用lambda表达式)进行编码,并且无法根据T / F的单选按钮选择来确定如何绑定文本框中的文本

在ViewModel中:

public List<string> IdEnabled { get; set; }

public List<string> IdDisabled { get; set; }
@Html.TextBoxFor("{something here? don't know}", "", new { @class = "small-textbox", @id = "FeatId"})
@Html.RadioButtonFor(model => model.IdEnable, true, new { @id = "Enable-Disable"})
@Html.Label("", "Enable", new { @class = "radiobutton-text", @for = "Enable-Disable" })
@Html.RadioButtonFor(model => model.IdDisable, false, new { @id = "Enable-Disable"})
@Html.Label("", "Disable", new { @class = "radiobutton-text", @for = "Enable-Disable" })

-然后是一个按钮,用于在最终提交之前添加信息并向用户显示

0 个答案:

没有答案