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