<%=Html.RadioButton("BookType","1") %> C# <%=Html.RadioButton("BookType","2") %> VB
<input id="BookType" name="BookType" type="radio" value="1" >C# <input id="BookType" name="BookType" type="radio" value="2" >VB
我需要同名但不同的ids
我想输出像
*:
<input id="rdoCSharp" name="BookType" type="radio" value="1" >C# <input id="rdoVb" name="BookType" type="radio" value="2" >VB
*:
解决方法
您可以通过使用
overload of the RadioButton method传递要应用的属性来覆盖默认值:
<%=Html.RadioButton("BookType","1",new { id = "yourId" }) %> C#