母版页错误

发布于 2024-08-29 03:02:32 字数 1010 浏览 1 评论 0原文

我正在使用 VS2010 Beta 2 创建一个全新的母版页,我收到此警告(这导致我在内容页面中出现错误):

验证(XHTML 1.0 过渡): 外部不支持内容 “script”或“asp:content”区域。

母版页的代码:

<%@ 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>

如您所见,它是默认母版页生成的代码。当我将标签悬停在顶部时,我收到警告。有人知道发生了什么事吗?

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

¢蛋碎的人ぎ生 2024-09-05 03:02:32

就我而言,从 web.config 文件的页面部分中删除 masterPageFile 属性后,错误就消失了:

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

或者,如果您在 web.config 文件中需要此属性,只需将空的 MasterPageFile 添加到母版页即可:

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

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="" %>
染火枫林 2024-09-05 03:02:32

很简单... Visual Studio 太疯狂了。事实上,事实是它不可能仅仅因为其中大部分是动态的而验证某些标记。例如,在我的项目中,我不断收到关于缺少

的警告。标签,因为它是动态添加的。底线:XHTML 验证器并不真正了解 ASP.NET 代码。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文