可以在 IE 中选择两个单选按钮 - C#

发布于 2024-08-03 09:27:00 字数 1641 浏览 1 评论 0原文

我认为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

送舟行 2024-08-10 09:27:00

渲染的 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.

放手` 2024-08-10 09:27:00

第二个按钮位于呈现的表单之外。如果您希望将单选按钮视为一组,则需要在表单内移动第二个单选按钮。

这是表单开始的地方:

<% 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>

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:

<% using(Html.BeginForm("CreateCustomerAccountLogin","BookingLogin")) {%>

Here's everything that's within the form:

    <%=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 />

Here's where the form ends:

    <% } %>

And here's everything else, outside the form:

    </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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文