【问题标题】:Getting A page can have only one server-side Form tag Error获取一个页面只能有一个服务器端Form标签错误
【发布时间】:2015-10-15 10:35:55
【问题描述】:

我已经完成了我的 MasterPage 并使用此 MasterPage 创建了一个新的 .aspx 页面。但是每当我尝试将RadioButton 添加到.aspx 页面时,都会向我生成此错误:

“RadioButton”类型的控件“head_ctl00”必须放在 带有 runat=server 的表单标签。

我尝试添加一个表单标签,结果出现了这个错误!

一个页面只能有一个服务器端表单标签。

我很困惑如何解决这个问题!任何想法 ?

如果您需要我的.aspx 页面:

<%@ Page Title="" Language="C#" MasterPageFile="~/MySite.Master" AutoEventWireup="true" CodeBehind="Registration.aspx.cs" Inherits="MyWebsite.Registration" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <form id="frm" runat="server">
        <asp:RadioButton runat="server"></asp:RadioButton>
    </form>
</asp:Content>

【问题讨论】:

  • 您是要添加另一个单选按钮还是指那个单选按钮?

标签: c# html asp.net webforms radio-button


【解决方案1】:

您已将 RadioButton 插入到 head 占位符中,该占位符在您的 MasterPage 文件中没有 form 标记。您应该将RadioButton 放在另一个PlaceHolder 中,例如MainContentFeaturedContent。你也不需要ContentPages 中的表单标签,母版页上的表单标签就足够了。

【讨论】:

    猜你喜欢
    • 2020-05-26
    • 2011-08-16
    • 1970-01-01
    • 2014-12-07
    • 1970-01-01
    • 2014-06-26
    • 2012-08-29
    • 2011-02-24
    相关资源
    最近更新 更多