Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I include thead in a runat="server" table element?
    text
    copied!<p>I'm upgrading a big web site project from Visual Studio 2010 to 2012. Throughout my project, I have <code>table</code> elements with the <code>runat="server"</code> attribute. Many of these have <code>thead</code> elements inside of them. When I open it in 2012 and and try to build, I get the following error:</p> <pre><code>Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot be converted to 'System.Web.UI.HtmlControls.HtmlTableRow' </code></pre> <p>Removing the <code>runat="server"</code> attribute or commenting out <code>thead</code> fixes it. Commenting out only the <code>tr</code> element inside of <code>thead</code> does not fix it. Here is a simplified example that reproduces the problem:</p> <pre><code>&lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" %&gt; &lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;table id="Example" runat="server"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;test&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;/table&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The error occurs where the <code>table</code> element opens.</p> <p>How can I fix this without doing one of the following?</p> <ul> <li>Removing the <code>runat="server"</code> attribute </li> <li>Removing the <code>thead</code> element</li> <li>Changing it to an <code>asp:table</code> element</li> </ul> <p>Bonus up vote for someone who explains what 2012 is doing differently that is causing this.</p> <p><strong>UPDATE:</strong></p> <p>The problem does not occur in a web <em>app</em>, only in a web site.</p> <p>The project isn't actually be upgraded, just my development environment. In both cases, I'm using the 4.0 framework</p> <p>I tried using the 4.5 framework, but it didn't help.</p> <p>Sept 10th, 2012: I have an open case with Microsoft support. Their dev team is looking into it.</p> <p>Oct. 24, 2012: Since .NET 4.5 replaces 4.0, I can no longer compile in VS 2010 also. The problem I am experiencing is purely .NET - not Visual Studio. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload