Thursday, January 2, 2014

Difference Between User Control and Custom Control

User control
1) Reusability web page
2) We can’t add to toolbox
3) Just drag and drop from solution explorer to page (aspx)
4) U can register user control to. Aspx page by Register tag
5) A separate copy of the control is required in each application
6) Good for static layout
7) Easier to create
8) Not compiled into DLL
9) Compiled at Run time
10)HTML design (Visual design possible)
11) ASP.Net page model with code behind
12)

Here page (user page) can be converted as control then
We can use as control in aspx

Custom controls

1) Reusability of control (or extend functionalities of existing control)
2) We can add toolbox
3) Just drag and drop from toolbox
4) U can register user control to. Aspx page by Register tag
5) A single copy of the control is required in each application
6) Good for dynamics layout
7) Hard to create
8) Compiled in to dll
9) Precompiled
10)No visual design. HTML needs to be declared programmatically
11) Component model

Custom Control Inherits from WebControl to achieve some extra functionality. These are classes.
Sample Custom Control
public class DropdownListExtended : DropdownList
{
    // My custom logic
    // ususaly an event is overriden by developers to achieve extra functionality
}
Webcontrols:- are TextBox, Label, DropdownList, e.t.c

No comments:

Followers

Link