可以在 IE 中选择两个单选按钮 - C#
我认为 C# 代码的位置导致我的单选按钮无法正常工作 - 到目前为止,此错误仅出现在 IE 中。希望这些信息足以获得一些反馈,我只是一个 HTML/CSS/JS 开发人员,谢谢!
<% 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>
I'm thinking it's the placement of the C# code that is making my radio buttons not function properly - this bug so far is only showing up in IE. Hope this is enough info to get some feedback, I'm just a HTML/CSS/JS dev, thanks!
<% 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
渲染的 HTML 代码中是否存在同一个 Form 标记的单选按钮部分?如果没有,请尝试使它们成为同一 form 标记的一部分,这应该可以解决您的问题。
Are there radio button part of same Form tag in rendered HTML code? If not try to make them part of same form tag which should solve your problem.
第二个按钮位于呈现的表单之外。如果您希望将单选按钮视为一组,则需要在表单内移动第二个单选按钮。
这是表单开始的地方:
这是表单内的所有内容:
这是表单结束的地方:
这里是表单之外的所有其他内容:
The second button is outside of the rendered form. If you want the radio buttons to be treated as a group then you need to move the second one inside the form.
Here's where the form starts:
Here's everything that's within the form:
Here's where the form ends:
And here's everything else, outside the form: