简体   繁体   中英

<asp:Content> does not correspond with <asp:ContentPlaceholder>

My ASP.NET page was not showing the controls. It just shows that master page error

The page has one or more <asp:content> controls that do not correspond with <asp:ContentPlaceHolder controls in the Master Page

Try setting

<title></title>

instead of

<title />

删除主文件中的注释(<%--%>),这对我有用。

All your Content controls have to reference existing ContentPlaceHolders on master page

For instance, if you have on your page

<asp:Content ContentPlaceHolderID="Header" ID="Title" runat="server">

You must have something like this on your master page

<asp:ContentPlaceHolder ID="Header" runat="server" />

ContentPlaceHolderID is the property that must match against any ContentPlaceHolder ID on master page.

The problem is that you must have a syntax error in the master.page's markup :

Ex) %²> in stead of %>

If you validate your markup, I'm sure thar this will solve your problem

PI. I has the same error & it works for me ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM