Custom Control

Custom control is a control that is not included in the .NET framework library and is instead created by a third-party software vendor or a user.

Custom control is a concept used while building both Windows Forms client and ASP.NET Web applications. Custom client controls are used in Windows Forms applications, while custom server controls are used in ASP.NET pages (Web forms). Using custom controls is easier in .NET than the earlier Windows versions due to simple programming techniques.

Custom control is a generic term that also includes user controls. User control in ASP.NET is created using ASP.NET code and is reused in other Web pages, whereas user control in the context of Windows Forms implies a composite control with a consistent user interface (UI) and behavior within or across applications.

.NET framework provides the class, System.Windows.Forms.Control, to build custom client control in Windows Forms. This class provides all the basic functionality necessary for controls, but does not provide any control-specific functionality or any graphical interface. Hence, it provides more flexibility than user control in defining the control to suit to application requirements by allowing an override of the default behavior of Windows message handling. Hence, knowledge of the Windows 32 API is essential to use this concept effectively. Windows Forms does not support windowless controls. However, it allows for the hosting of ActiveX controls, which can be windowless.


To generate custom control in ASP.NET, the framework class, System.Web.UI.WebControl, should be used along with System.Web.UI.Control to render non-visual elements. These controls provide the ability to be shipped as a dynamic link library (.dll), which can be precompiled and integrated with Visual Studio Integrated Development Environment.

Some of the aspects that need to be considered while building custom controls include the definition of properties with their default values, which need to be displayed in Visual Studio IDE, behavior in the UI layout (like tab order, UI cues, etc.), and custom events. Sometimes, custom control can be built by combining built-in controls to provide complex functionality.

It is recommended that custom controls be used when customized graphical representation of the control is needed or when there is a need to implement custom functionality that is not provided by standard controls.

This definition was written in the context of .NET

Post a Comment

0 Comments