gpt4 book ai didi

asp.net - BC30311 错误 : Why can't I use a PlaceHolder inside a table for a specific user control?

转载 作者:行者123 更新时间:2023-12-04 06:17:24 26 4
gpt4 key购买 nike

我们有一个标准的 asp.net web 应用程序,并在多个地方使用了 asp:PlaceHolders。在某些文件中,我们在运行时收到此错误消息:

BC30311: Value of type 'System.Web.UI.WebControls.PlaceHolder' cannot be converted to 'System.Web.UI.HtmlControls.HtmlTableRow'.



为什么?

如果我删除占位符,页面呈现就好了。

这是html(简化版):
<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>

版本信息:Microsoft .NET Framework 版本:2.0.50727.5446; ASP.NET 版本:2.0.50727.5420

最佳答案

因为您在服务器上运行表,所以它只需要嵌套在其中的表元素。如果您将 runat="server 从表中取出,它应该可以正常工作。

关于asp.net - BC30311 错误 : Why can't I use a PlaceHolder inside a table for a specific user control?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7063922/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com