【问题标题】:Asp.net UserControl with Templates is not working inside user controls带有模板的 Asp.net UserControl 在用户控件中不起作用
【发布时间】:2011-01-07 20:02:37
【问题描述】:

我创建了一个真正简单的模板化 UserControl 和

我现在可以使用以下方法将此控件添加到我的 Asp.net WebApplication:

<components:Box BoxType="Help" Title="Content Title" runat="server">
    <Content>
        <asp:TextBox runat="Server" ID="txtName"/>
        This is my awesome content!<br />
        <b>Test</b>
    </Content>
</components:Box>

我可以将其嵌入页面 (aspx) 但我不在用户控件 (ascx) 中工作。当我在用户控件中使用它时,设计器文件(.ascx.designer.cs)本身不会生成。

得到以下错误:

元素“盒子”不是已知元素。如果网页中存在错误,则可能会发生这种情况,或者 web.config 文件丢失。

更新:有时它有效!我创建了几个控件。它在某些地方有效,在其他地方无效。

谢谢!

【问题讨论】:

    标签: asp.net user-controls


    【解决方案1】:

    【讨论】:

    • 问题略有不同。我想在另一个 (B) 中使用一个用户控件 (A)。在 (A) 中没有任何模板化控件,它工作正常。但如果 (A) 中定义了任何模板化控件,则它不起作用。这是特定于 Asp.Net Web 应用程序项目的。它在 Asp.net 网站中运行良好。
    • @Mahes:嗯,那我不确定。我将不得不进一步研究。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-27
    • 1970-01-01
    • 1970-01-01
    • 2012-02-09
    • 2011-05-09
    • 2019-07-03
    相关资源
    最近更新 更多