且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

具有强绑定模型 MVC 的 ASP.NET MVC 是/否单选按钮

更新时间:2023-02-25 08:03:21

第二个参数被选中,所以使用!当布尔值为 false 时选择 no 值.

The second parameter is selected, so use the ! to select the no value when the boolean is false.

<%= Html.RadioButton("blah", !Model.blah) %> Yes 
<%= Html.RadioButton("blah", Model.blah) %> No