【问题标题】:What are Custom Controls? What is the basic difference between the user controls and custom controls?什么是自定义控件?用户控件和自定义控件之间的基本区别是什么?
【发布时间】:2011-07-12 11:23:39
【问题描述】:

谁能给我一个最好的带有代码 sn-p 的自定义控件应用程序,并解释一下自定义控件和用户控件之间的基本区别? 提前致谢 , 拉克斯米

【问题讨论】:

标签: asp.net c#-4.0


【解决方案1】:

用户控件是 WebControls 的集合或分组。它类似于aspx页面,用于将常用的标记代码放在一个常用的文件中。

参考Web Forms User Controls创建用户控件,将页面转换为用户控件,消费用户控件等

自定义控件继承自 WebControl 以实现一些额外的功能。这些是类。

自定义控件示例

public class DropdownListExtended : DropdownList
{
    // My custom logic
    // ususaly an event is overriden by developers to achieve extra functionality
}
  • Webcontrols:- 是 TextBox、Label、DropdownList 等

希望你的理解是建立的。

【讨论】:

  • @enjoyprogramming,在这种情况下考虑可用性而不是性能会更好。
猜你喜欢
  • 1970-01-01
  • 2010-11-02
  • 2010-11-22
  • 2010-10-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-06-11
相关资源
最近更新 更多