【问题标题】:Can I place ASP.NET user controls on pages without a control declaration?我可以在没有控件声明的页面上放置 ASP.NET 用户控件吗?
【发布时间】:2010-10-23 06:20:39
【问题描述】:

我想在页面上放置用户控件而不在页面顶部注册标签。例如:

<p>some text</p>
<myname:mycontrol runat="server" />

这可能吗?听说可以在 web.config 中进行标签声明...是真的吗?

如果是这样,知道哪些 .NET 框架版本支持此功能吗?

谢谢

【问题讨论】:

    标签: asp.net user-controls controls web-config declaration


    【解决方案1】:

    在 .net 2.0 web.config 中:

    <pages>
        <controls>
        <add tagPrefix="MYPREFIX" namespace=="MyNamespace.Stuff" assembly="MyAssembly" />
    

    更深入的讨论http://weblogs.asp.net/scottgu/archive/2006/11/26/tip-trick-how-to-register-user-controls-and-custom-controls-in-web-config.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-03
      相关资源
      最近更新 更多