如何在runat ="server"表元素中包含thead?

Kei*_*ton 19 asp.net upgrade visual-studio-2010 vs-web-site-project visual-studio-2012

我正在将一个大型网站项目从Visual Studio 2010升级到2012年.在整个项目中,我都有属性的table元素runat="server".其中许多都有其中的thead元素.当我在2012年打开它并尝试构建时,我收到以下错误:

Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot be converted to 'System.Web.UI.HtmlControls.HtmlTableRow'
Run Code Online (Sandbox Code Playgroud)

删除runat="server"属性或注释掉thead修复它.只注释掉tr里面的元素thead并不能解决它.以下是重现问题的简化示例:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table id="Example" runat="server">
            <thead>
                <tr>
                    <th>test</th>
                </tr>
            </thead>
        </table>
    </div>
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

table元素打开时会发生错误.

如何在不执行以下操作之一的情况下解决此问题?

  • 删除runat="server"属性
  • 删除thead元素
  • 将其更改为asp:table元素

为那些解释2012年正在采取不同行为导致此问题的人投票.

更新:

Web 应用程序中不会出现此问题,仅在网站中出现此问题.

该项目实际上并未升级,只是我的开发环境.在这两种情况下,我都在使用4.0框架

我尝试使用4.5框架,但它没有帮助.

2012年9月10日:我有一个微软支持的开放案例.他们的开发团队正在研究它.

2012年10月24日:由于.NET 4.5取代了4.0,我不能再在VS 2010中编译了.我遇到的问题纯粹是.NET - 而不是Visual Studio.