我的模式是:制作用户在ASP.NET MVC中选择一个单选按钮
,并在视图中,我使用:
<td style="vertical-align:top" Width="60%">Is this OK ?</td>
<td>
@Html.RadioButton("OK", "Yes") Yes @Html.RadioButton("Ok", "No") No
</td>
我需要@Html.RadioButtonFor
还是我失去了还有一些因为单选按钮验证未激活。
提交按钮,我只是在做
<button type="submit" class="btn btn-primary">Sign up</button>
和BeginForm是: -
@using(Html.BeginForm("addsurvey","survey"))
{
验证仍不起作用。 – MiscellaneousUser
你是什么意思?不显示“你必须选择一个OK选项”或其他东西?请解释什么是问题,因为很难准确地分辨出你写的“不起作用”时所要求的。 – Marusyk
如果我单击提交按钮(添加),则提交页面时无需选择单选按钮。验证不起作用,并且绑定的值为空而不是“是”或否。 – MiscellaneousUser