Custom Control

What Does Custom Control Mean?

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.

Techopedia Explains Custom Control

.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.


Related Terms

Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.