我认为这是放置C#代码使我的单选按钮无法正常工作 - 到目前为止这个错误只出现在IE中。希望这足以获得一些反馈,我只是一个HTML / CSS / JS dev,谢谢!
<% using(Html.BeginForm("CreateCustomerAccountLogin","BookingLogin")) {%>
<%=this.Hidden(x=>x.SID) %>
<div><input class="radio" type="radio" name="NewAccount" checked="checked" value="true" />
<label>
I want to create a new account
</label></div>
<div id="new-account">
<%=this.TextBox(x => x.LoginName).Label("Email Address:")%>
<br />
<%=this.TextBox(x => x.ConfirmLoginName).Label("Confirm Email Address:")%><%= this.ValidationMessage(x=>x.ConfirmLoginName) %>
<br />
<%=this.Password(x => x.Password).Label("Password:")%><%= this.ValidationMessage(x=>x.Password) %>
<br />
<%=this.Password(x => x.Password).Label("Confirm Password:")%>
<br />
<%=this.TextBox(x => x.ZipCode).Label("ZipCode:")%><%= this.ValidationMessage(x=>x.ZipCode) %>
<br />
<% } %>
</div>
<div><input class="radio" type="radio" name="NewAccount" value="false" />
<label class="wide">
I want to continue without logging in
</label>
<div>
<div class="button-container-right">
<input class="button-primary" type="image" src="../Content/images/button-primary.jpg" border="0" id="btnSubmit" /></div></div></div>
答案 0 :(得分:3)
呈现的HTML代码中是否有相同表单标记的单选按钮部分?如果没有尝试使它们成为同一形式标记的一部分,它可以解决您的问题。
答案 1 :(得分:3)
第二个按钮位于渲染表单之外。如果您希望将单选按钮视为一个组,则需要在表单内移动第二个。
这是表单开始的地方:
<% using(Html.BeginForm("CreateCustomerAccountLogin","BookingLogin")) {%>
以下是表格中的所有内容:
<%=this.Hidden(x=>x.SID) %>
<div><input class="radio" type="radio" name="NewAccount" checked="checked" value="true" />
<label>
I want to create a new account
</label></div>
<div id="new-account">
<%=this.TextBox(x => x.LoginName).Label("Email Address:")%>
<br />
<%=this.TextBox(x => x.ConfirmLoginName).Label("Confirm Email Address:")%><%= this.ValidationMessage(x=>x.ConfirmLoginName) %>
<br />
<%=this.Password(x => x.Password).Label("Password:")%><%= this.ValidationMessage(x=>x.Password) %>
<br />
<%=this.Password(x => x.Password).Label("Confirm Password:")%>
<br />
<%=this.TextBox(x => x.ZipCode).Label("ZipCode:")%><%= this.ValidationMessage(x=>x.ZipCode) %>
<br />
这是表单结束的地方:
<% } %>
这是其他一切,在表格之外:
</div>
<div><input class="radio" type="radio" name="NewAccount" value="false" />
<label class="wide">
I want to continue without logging in
</label>
<div>
<div class="button-container-right">
<input class="button-primary" type="image" src="../Content/images/button-primary.jpg" border="0" id="btnSubmit" /></div></div></div>