Literally speaking, "a control is custom for user if it
fulfills a requirement that can’t be satiated by any standard control."
The term custom control becomes vague sometime for the user when there is a
parallel term of user controls which are also custom controls in nature, but
are created differently. I would like to put light on this ambiguity and will
try to resolve it. Yet before this, it is more important to know the types of
custom controls and their place in the hierarchy of controls.
It is important to know that all controls are server
controls i.e. they run at server and are rendered into the appropriate HTML
controls at the client's browser.
We can make two major level categories of server controls.
Just In Time (JIT) Compiled
JIT compiled controls are those controls that are embeddable
in the source of aspx page and are compiled as per demand i.e. just in time.
These controls, directly or indirectly, are inherited from System.Web.UI.WebControls.WebControl
or System.Web.UI.Control which let them expose properties and provide events.
They are compiled when the page gets compiled by the Framework. The following
are the main types of JIT compiled controls.
HTML server controls
Web server controls
Let us take a look on these controls one by one.
HTML Server Controls
HTML controls support an additional property of “runat.” If
this set is to “server,” it runs at server and is accessible in the code
behind. Therefore, it is said to be an HTML Server control. Since these
controls require less UI support, they are inherited from System.Web.UI.Control.
Web Server Controls
Web server controls are all standard server side controls
that are shipped with ASP.NET. They include simple controls such as Panel and
as rich as GridView. The basic purpose of these controls is to minimize the
effort required for designing pages or building tools/controls that
automatically generate user interface. These controls hide details of their
internal working and make the task easier and less erroneous for developers. It
is important to know that these controls inherit one of these two classes.
It defines the properties, methods, and events that are
common to all web server controls, for example methods and events needed handle
the execution lifecycle. This does not support any UI specific feature. The
controls that require no UI support inherit this class, such as ASP.NET
controls including Literal, Repeater, PlaceHolder and XML.
The WebControl class inherits Control class and exposes
additional properties and provides methods for UI support. A control that
renders some UI should be inherited from WebControl. It is the class which
provides UI-related properties such as BackColor, ForeColor, Font, Height,
Width, etc. All ASP.NET controls except aforementioned controls inherit this
These controls are used for validation of the input of other
controls of a page/user control. These controls can perform client side, server
side or both types of validation. Validation controls inherits the BaseValidator
class that implements IValidator interface and inherits Label class, thus they inherit
Lastly let us have a look at user controls and know how they
are different from custom controls. User controls are custom in nature by
purpose not by architecture. Development and design-wise they have nothing
common with custom controls. They are closer to an aspx page than a custom
control. This may be a bit misleading yet we have to take them entirely
separate. Their architecture and way of working is entirely different the only
thing that is common is they both can fulfill custom needs of a user.
The following are the important differences between a user
control and a custom control from all aspects.