只允许使用内容控件(C#网络控件)

只允许使用内容控件(C#网络控件),c#,asp.net,master-pages,code-behind,web-controls,C#,Asp.net,Master Pages,Code Behind,Web Controls,所以,我不知道发生了什么。我的老板不喜欢我使用MVC和Razor,所以我不得不用这种讨厌的网络控制/代码隐藏风格来编码=/ 错误是: Only Content controls are allowed directly in a content page that contains Content controls. 以下是主页: <%@ Master Language="C#"%> <!DOCTYPE html> <html> <head>

所以,我不知道发生了什么。我的老板不喜欢我使用MVC和Razor,所以我不得不用这种讨厌的网络控制/代码隐藏风格来编码=/

错误是:

Only Content controls are allowed directly in a content page that contains Content controls.
以下是主页:

<%@ Master Language="C#"%>
<!DOCTYPE html>
<html>
<head>
    <title>Application Form</title>
</head>
 <body>
    <div id="container">
        <asp:contentplaceholder id="contentPlaceHolder" runat="server" />
    </div>
</body>
</html>

所有内容(包括静态HTML)必须位于内容页的
content
标记内。您有一个
外部:

<h2>Application Form</h2>
<asp:Content id="content" ContentPlaceHolderID="contentPlaceHolder" runat="server">
申请表
应该是:

<asp:Content id="content" ContentPlaceHolderID="contentPlaceHolder" runat="server">
    <h2>Application Form</h2>

申请表

是的,它可能很烦人=]但是如果你仔细想想,它是有道理的,如果它在母版页的内容占位符之外,那么它应该在页面中的哪个位置;在主体的开始处,即主体的结束处,渲染遇到主体时位于何处?只是知道范式才有意义。x、 谢谢你这么好~!当它允许我的时候,我会把它标记正确!没问题,很高兴我能帮忙
<h2>Application Form</h2>
<asp:Content id="content" ContentPlaceHolderID="contentPlaceHolder" runat="server">
<asp:Content id="content" ContentPlaceHolderID="contentPlaceHolder" runat="server">
    <h2>Application Form</h2>