我可以在没有控件声明的页面上放置ASP.NET用户控件吗?

时间:2022-09-02 11:58:49

I would like to put user controls on pages without registering the tag at the top of the page. For example:

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

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

Is this possible? I've heard that tag declarations can be done in web.config... is this true?

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

If so, any idea which .NET framework versions support this?

如果是这样,任何.NET框架版本支持这个的想法?

Thanks

1 个解决方案

#1


in .net 2.0 web.config :

在.net 2.0 web.config中:

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

Much more thorough discussion http://weblogs.asp.net/scottgu/archive/2006/11/26/tip-trick-how-to-register-user-controls-and-custom-controls-in-web-config.aspx

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

#1


in .net 2.0 web.config :

在.net 2.0 web.config中:

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

Much more thorough discussion http://weblogs.asp.net/scottgu/archive/2006/11/26/tip-trick-how-to-register-user-controls-and-custom-controls-in-web-config.aspx

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