开发者

Error with masterpage

开发者 https://www.devze.com 2022-12-26 17:34 出处:网络
i\'m creating a brand new masterpage with VS2010 Beta 2 and I get this warning (that causes me errors in the content pages):

i'm creating a brand new masterpage with VS2010 Beta 2 and I get this warning (that causes me errors in the content pages):

Validation (XHTML 1.0 Transitional): Content is not supported outside 'script' or 'asp:content' regions.

The masterpage's code :

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Bob.master.cs" Inherits="TShirtFactory.Web.All.Core.lib.masterpage.Bob" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" 开发者_运维百科runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

As you can see, it's the default masterpage generated code. I get the warning when I hover the tag at top. Does anybody have an idea of what's going on ?

Thank you


In my case the error has gone after removing masterPageFile attribute from the Page-section in the web.config file:

<configuration>
  <system.web>
     <pages styleSheetTheme="mystyle" masterPageFile="~/myMaster.master" />       
  </system.web>
</configuration>

Or, if you need this attribute in the web.config file, just add empty MasterPageFile to you master page:

<%@ Master Language="VB" AutoEventWireup="false" CodeFile="mySecondMaster.master.vb" Inherits="mySecondMaster" MasterPageFile="" %>


It's simple... Visual Studio is bonkers. Actually, the truth is that it can't possibly validate some markup simply because much of it is dynamic. For instance, in my project I have a constant warning about the lack of a <title> tag because it's added dynamically. Bottom line: the XHTML validator does not really know much about ASP.NET code.

0

精彩评论

暂无评论...
验证码 换一张
取 消