ASP.NET 自动加载用户控件,无需 web.config
嗨,我必须在 asp.net 2.0 中进行自动加载(但如果不可能,请向我展示更高版本)。在 aspx 文件中,我有正常的标签,就像
<aaa:BBB ID="ccc" runat="server" />
我在 web.config 中添加的控件一样,如 system.web->pages->controls->;
<add src="zzz" tagName = "BBB" tagPrefix="aaa" />
我不想在 web.config 中添加行,因为我有很多很多针对特定项目的用户控件,而且它变得很混乱。
我想要什么?自动加载器 :) 也许对 web.config 进行一些微调?我知道 web.config 被解析为一些管理它的类。您甚至可以写入此类,但您也可以写入 web.config 文件...增加它的大小:(
Hi I've got to do autoloading in asp.net 2.0 (but if it's impossible please show me for higher version). In aspx files I've got normal tags like
<aaa:BBB ID="ccc" runat="server" />
I've also in web.config added controls like system.web->pages->controls->
<add src="zzz" tagName = "BBB" tagPrefix="aaa" />
I would like to not add lines to web.config cause I've got lots and lots of user controls for specific projects and it's getting messy.
What I would like? Autoloader :) Maybe some fine tuning of web.config? I know that web.config is parsed into some classes which manage it. You can even write to this classes, but you also write to web.config file...increasing it's size :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,asp.net 模板控件没有自动加载器。例如:SharePoint 有许多基于模板的控件 (ascx),并且每个控件都必须单独注册。
不过,您不必在 web.config 中注册每个控件,您可以仅在使用它们的页面上注册它们。
http://msdn.microsoft.com/en-us/library/c76dd5k1.aspx
To my knowledge, there is no auto loader for asp.net template controls. eg: SharePoint has lots of template based controls (ascx), and each one has to be registered individually.
You don't have to register every control in web.config though, you can register them just on the page that uses them.
http://msdn.microsoft.com/en-us/library/c76dd5k1.aspx