创建自定义扩展控件时的困惑
我有两个问题紧密相连。
当您查看 msdn 上有关创建扩展器控件的文档时,他们宣扬新控件必须继承 ExtenderControl
,它是 Asp.net Ajax Library
参考的一部分:阅读有关它的更多信息,但在阅读有关扩展器控件的更多信息时,我还发现this 声明控件必须从 ExtenderControlBase
它是 AjaxControlToolkit
的一部分。仔细想想,这是没有意义的,Toolkit 已经是扩展控件集合,
为什么我的新控件要从实际上继承自
Microsoft Ajax Library
的另一个基础继承,这也使使用我的控件的客户端还包括 Toolkit dll,无论他们是否喜欢。此外,我上面给出的参考文献中设置的方式属性也是对比的。 Msdn 使用
get/set
方法来实现,但 Toolkit 文档更喜欢GetValue、SetValue
。现在要遵循的是。
3.虽然这不是一个真正的问题,但是你如何维护我的控件类库现在已经设置好,根本没有任何安排。您是否根据文件夹来排列它们?你是根据它们的功能来放置它们的吗?
I got 2 questions which are tightly coupled here.
When you look into the documentation on msdn about creating extender controls they preach that the new control must inherit from ExtenderControl
which is part of the Asp.net Ajax Library
reference:read more about it but on reading more about extender controls i also found this which states that control must inherit from ExtenderControlBase
which is part of AjaxControlToolkit
. Which on thinking doesn't make sense, Toolkit is already extender control collection and
why should my new control inherit from another base which actually inherits from
Microsoft Ajax Library
this also makes client who use my control to also include Toolkit dll whether they like it or not.Also the manner properties set in both the reference i gave above is contrasting. Msdn does it with
get/set
methods but Toolkit docs preferGetValue, SetValue
. Which am to follow now.
3.This is not really a question though, but How do you maintain class library of controls mine is setup right now with no arrangement at all. Do you arrange them based on folders? Do you put them based on their function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1)
ExtenderControl
是 .NET 框架的一部分,并且是一个抽象类,可以从其扩展以使用您自己的实现创建您自己的扩展器控件。ExtenderControlBase
来自外部AjaxControlToolkit
库,它扩展了ExtenderControl
以提供更完整的实现,可以在库中进一步使用,并且可以使用由其他人。它可以节省从头开始构建自己的工作量,因为您可以利用现有的实现。2) 使用与您决定使用的引用相匹配的
get/set
语法。3) 约定通常是使用与名称空间匹配的文件夹结构,并以逻辑方式分组。基于功能听起来是一种明智的方式。
1)
ExtenderControl
is part of the .NET framework and is a abstract class to extend from to create your own extender controls using your own implementation.ExtenderControlBase
is from the externalAjaxControlToolkit
library which extendsExtenderControl
to provide a more complete implementation that is further used within the library, and that can be used by others. It saves effort in building your own from scratch as you can leverage the implementation already in place.2) Use whichever
get/set
syntax matches the reference you decide to use.3) The convention is usually to use a folder structure that matches namespaces, grouped in a logical manner. Based on function sounds like a sensible way.