开发者

BC30311 error: Why can't I use a PlaceHolder inside a table for a specific user control?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜