I have a .NET 3.5 web site with a table tag that contains col, colgroup, tbody and thead tags. This is a server side tag with the runat="server" attribute. This table was working fine in Visual Studio 2010, but after I installed Visual Studio 2012 and .NET 4.5, this tag now fails to compile in Visual Studio 2010 and in Visual Studio 2012. (I tried both.) Here are the compiler errors that are being thrown:
- The best overloaded method match for 'System.Web.UI.HtmlControls.HtmlTableRowCollection.Add(System.Web.UI.HtmlControls.HtmlTableRow)'
has some invalid arguments
- Argument '1': cannot convert from 'System.Web.UI.HtmlControls.HtmlGenericControl' to
'System.Web.UI.HtmlControls.HtmlTableRow'
Here's an example of what I'm working with:
<table id="TestTable" runat="server">
<colgroup>
<col width="30%" />
<col width="70%" />
</colgroup>
<thead>
<tr>
<td>Sample header 1</td>
<td>Sample header 2</td>
</tr>
</thead>
<tbody>
<tr>
<td>Sample cell 1</td>
<td>Sample cell 2</td>
</tr>
<tr>
<td>Sample cell 3</td>
<td>Sample cell 4</td>
</tr>
</tbody>
</table>
Does anyone know how to fix this problem, so that we can get the site to compile and continue working?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…