We have a standard asp.net web application and have used asp:PlaceHolders in multiple places. In some files we get this error message during runtime:
BC30311: Value of type 'System.Web.UI.WebControls.PlaceHolder' cannot be convert开发者_运维问答ed to 'System.Web.UI.HtmlControls.HtmlTableRow'.
Why?
If I remove the place holder the page renders just fine.
Here is the html (simplified version):
<table runat="server" id="tblExtradata" visible=true>
<asp:PlaceHolder ID="test" runat="server" Visible="true">
<tr>
<td>
<asp:Label ID="lblExpenses" runat="server" Text="Expensesr"></asp:Label>
</td>
</tr>
</asp:PlaceHolder>
</table>
Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420
Because you're running the table at the server, it expects only table elements nested within. If you take the runat="server out of the table, it should work fine.
精彩评论