通用ServerControl语法? [英] Generic ServerControl syntax?
问题描述
有没有办法,我可以有一台服务器控制的一种方式。
Is there a way that I can have a server control
MyControl<T>
这样我可以注册并使用它在aspx页面像这样
so that I can register and use it in an aspx page like so
<mc:MyControl<ThingForControlToUse> ID="instanceOfMyControl" runat="server"
显然,设计师不喜欢这一点,是否有任何很酷的方式绕着它比其他同类型参数创建非通用包装?
Obviously the designer doesn't like this, are there any cool ways round it other than creating a non generic wrapper with a type parameter?
推荐答案
通用标签名称是不可能在ASP.NET,请参考这篇文章:<一href=\"http://weblogs.asp.net/ysolodkyy/archive/2007/10/02/control-builders-amp-asp-net-generic-control-classes.aspx\"相对=nofollow>通用控制
Generic Tag Names are not possible in ASP.NET, please refer to this article: Generic Controls
您在想,你需要创建一个类型参数的包装在正确的轨道上。
You are on the right track in thinking that you will need to create a wrapper with a TYPE parameter.
这篇关于通用ServerControl语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!