@Html.Ra@R_404_410@ButtonFor(Model => Model.Location,"Location") @Html.LabelFor(Model=>Model.Location,"Location") @Html.Ra@R_404_410@ButtonFor(Model=>Model.Model,"Model") @Html.LabelFor(Model=>Model.Model,"Model") @Html.Ra@R_404_410@ButtonFor(Model=>Model.MovableUnit,"MU") @Html.LabelFor(Model=>Model.MovableUnit,"MU") <input id="Location" name="Location" type="ra@R_404_410@" value="Location" /> <label for="Location">Location</label> <input id="Model" name="Model" type="ra@R_404_410@" value="Model" /> <label for="Model">Model</label> <input id="MovableUnit" name="MovableUnit" type="ra@R_404_410@" value="MU" /> <label for="MovableUnit">MU</label>
所有上述单选按钮如何使用通用名称=“ra@R_404_410@btn”?
问题是我想一次只选择一个单选按钮,但在这种情况下,所有这些都可以同时选择.
解决方法
只要在你的Model类中创建一个虚拟属性,
public string Dummy {get;组;}
public string Dummy {get;组;}
@Html.Ra@R_404_410@ButtonFor(Model => Model.Location,"LOC",new { @Name = "Dummy"}) @Html.Ra@R_404_410@ButtonFor(Model => Model.Model_Number,"MOD",new { @Name = "Dummy" }) @Html.Ra@R_404_410@ButtonFor(Model => Model.MovableUnit,"MU",new { @Name = "Dummy" })