Difference between User Control and Custom Control

Key Difference: In ASP.net framework, a user control and a custom control are used to serve the purpose of re-usable components as controls. User controls are created just like a web form. They make use of the existing controls to define their own logic. On the other hand, a custom control is the one which is made or created by the programmer to serve the business needs by extending the functionality of existing controls. User controls are simple to create than the custom controls.

Basically, a control is a fundamental user interface object. In ASP.net, controls are often classified into user and custom controls. User controls provide the reusability of design and are created in the same way as a web form. They have an .ascx extension. User controls are quiet helpful if they have to be used only for a particular website. They have a visual interface. These controls are loaded at the runtime, and thus cannot be found in the toolbox.

On the other hand, custom controls are developed or created by coding. They are created according to the requirement of the business. They are quiet useful as they can be used across different applications. They do not have a visual interface. These controls can be easily added to the toolbox. Custom controls are often preferred as they can be shared across web applications, however the absence of visual designer for creating custom controls is often regarded as a limitation.

User Controls must be preferred to divide the functionality into manageable pieces of logic. These pieces can be created without any kind of dependence on the application or on other controls. They are also extensively used to group the related components for the reusability purpose. On the other hand, custom controls are preferred for creating a particular version of a control. They are quiet helpful in providing the extended capability to the basic controls.

Comparison between User Control and Custom Control:

 

User Control

Custom Control

Definition

User controls are created just like a web form. They make use of the existing controls to define their own logic.

A custom control is the one which is made or created by the programmer to serve the business needs, by extending the functionality of existing controls. 

Creation

Easy

Complex

Runs on

Do not run on their own dll

Run on their own dll

Reusability

Web page

Control

Toolbox

Cannot be added to toolbox

Can be added to toolbox

Preferred for

Static layout

Dynamic layout

Usability

Single copy can be used for different projects

Separate copy is required for each application

Flexibility

Less

More

Image Courtesy: kirupa.com, codeproject.com

Most Searched Non-Alcoholic Drinks Most Searched in Health
Most Searched in Environment Most Searched in Sports
Multiplexer vs Encoder
Slim vs Skinny
Stickball vs Australian Stickball
Mobile Banking vs Internet Banking

Add new comment

Plain text

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.