VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot be converted to 'System.Web.UI.HtmlControls.HtmlTableRow'.
RSS
I was able to get rid of the error in one of two ways:
Remove the <thead> tags
Remove the runat="server" from the table tag
Both methods get rid of the error. Since the table is not referenced in the code-behind, I took out the runat="server" to fix the immediate problem. Not sure why VS2012 had a problem with it when VS2010 did not.
I don't have any <thead>. What makes this worse is that, even thought the web sites are supposed to be compatible with the new round-tripping feature of 2012, when I compile this in 2010 now, I get the same compile errors.
The solution here is to remove runat="server" or to remove the <thead>.
Also please note that, its not only the <thead>, but in case your code has <tbody> that could also affect the compilation.
This is obviously not a visual studio issue but a framework issue, because once VS 2012 was installed the project was failing compilation on both VS2010 and VS2012.
ojm37
Contributor
2248 Points
832 Posts
VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot be c...
Aug 17, 2012 01:36 PM|LINK
I've just upgraded to VS2012 and I'm getting the following error on a website project that compiles and runs without error in VS2010:
Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot be converted to 'System.Web.UI.HtmlControls.HtmlTableRow'.
The file the error specifies is an ascx file (web user control) and the line in question is:
<table width="100%" id="tblTitle" runat="server"><thead><tr><th><asp:PlaceHolder ID="phTitle" runat="server"></asp:PlaceHolder></th><th id="cellRSS" runat="server" visible="false" style="width:36px;"><asp:Hyperlink ID="linkRSS" runat="server" NavigateUrl="/rss/rss.aspx"><img src="/images/utility/xml.gif" border="0" alt=""/></asp:Hyperlink></th></tr></thead></table>
Anyone have ANY idea what the bleep VS2012 is talking about? I don't see a generic control where a table row should be.
BTW, does anyone else think VS2012 is BUTT UGLY!?
TIA,
ojm37
Contributor
2248 Points
832 Posts
Re: VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot ...
Aug 17, 2012 06:50 PM|LINK
I was able to get rid of the error in one of two ways:
Both methods get rid of the error. Since the table is not referenced in the code-behind, I took out the runat="server" to fix the immediate problem. Not sure why VS2012 had a problem with it when VS2010 did not.
Cheers,
dcutting
Member
25 Points
8 Posts
Re: VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot ...
Aug 30, 2012 07:02 PM|LINK
Unfortunately removing the runat="server" is not a valid solution for me as it is referenced in the code behind.
ojm37
Contributor
2248 Points
832 Posts
Re: VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot ...
Aug 30, 2012 07:03 PM|LINK
try taking out the <thead> tags then. That worked for me as well.
dcutting
Member
25 Points
8 Posts
Re: VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot ...
Aug 30, 2012 07:39 PM|LINK
I don't have any <thead>. What makes this worse is that, even thought the web sites are supposed to be compatible with the new round-tripping feature of 2012, when I compile this in 2010 now, I get the same compile errors.
dcutting
Member
25 Points
8 Posts
Re: VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot ...
Aug 31, 2012 05:22 PM|LINK
<table> ... <br /> </table>dcutting
Member
25 Points
8 Posts
Re: VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot ...
Aug 31, 2012 05:23 PM|LINK
For the record, I don't think VS21012 is butt ugly. I like it.
dcutting
Member
25 Points
8 Posts
Re: VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot ...
Aug 31, 2012 05:25 PM|LINK
for some reason it didnt' include my comment. I had to get rid of the <br> tag nested in the table (moved it outside the table and it worked)
ojm37
Contributor
2248 Points
832 Posts
Re: VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot ...
Aug 31, 2012 05:41 PM|LINK
It IS growing on me.
habeeb_matri...
Member
12 Points
15 Posts
Re: VS2012 Website compile: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot ...
Sep 06, 2012 05:27 AM|LINK
Thats right.
The solution here is to remove runat="server" or to remove the <thead>.
Also please note that, its not only the <thead>, but in case your code has <tbody> that could also affect the compilation.
This is obviously not a visual studio issue but a framework issue, because once VS 2012 was installed the project was failing compilation on both VS2010 and VS2012.
VS2010