Saturday, August 21, 2010

Some VS Bugs

Error

"the page has one or more <asp:content> that do not correspond with <asp:ContentPlaceHolder> controls in masterpage"

Apparently I’m using a wrong contentPlaceHolderId which doesn’t exist in my master page but that’s not true. Here is my Page

<asp:Content ContentPlaceHolderID="Head" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderID="Content" runat="server">
</asp:Content>
 


And my Master page looks like this

<head id="h" runat="server">    
<title id="t" runat="server" title='<%$ CurrentPage: Title %>' />
<asp:ContentPlaceHolder ID="Head" runat="server">
<link rel="canonical" href="<%= CurrentPage != null ? CurrentPage.Url : Request.RawUrl %>" />
</asp:ContentPlaceHolder>
</head>

 


It all looks good to me so where is the problem? Error message is not very friendly in this case and error and solution both seems pretty weird.
Solution: The title tag should not be used as a single closed tag e.g. <title /> instead it should be written as <title></title> and the problem will go away. Look out for other tags as well such as <script />. It doesn’t work very well in the single close tag. Use explicit close tag wherever possible. Browsers are forgiving in nature but not the VS

Author : Unknown // 2:25 PM
Category:

0 comments:

 

Google Analytics

Popular Posts

Powered by Blogger.