3
Reply

What is difference between Custom Control and User Control?

Nisha Regil

Nisha Regil

4y
2.7k
3
Reply

    The main difference between Custom Control and User Control is that they inherit from different levels in the inheritance tree:

    Custom Control

    MyCustomControl
    |-> Control
    |-> Component

    User Control

    MyUserControl
    |-> ContainerControl
    |-> ScrollableControl
    |-> Control
    |-> Component

    So, in short you get a different amount of pre-wired functionality with the different options.

    When would you use the different options? (these are thoughts and opinions, not truths)

    Create a custom control if you want to make a component where you have full control over its visual appearance, and you don’t want any baggage of unnecessary functionality. Typical cases would be simple controls with limited functionality (such as a button)

    Create a user control if you are going to combine existing controls into reusable building blocks (such as two lists with buttons where you can move items between the lists).

    For more details:

    https://stackoverflow.com/questions/1322451/what-is-the-difference-between-user-control-custom-control-and-component#:~:text=The%20main%20difference%20between%20them,be%20used%20in%20multiple%20applications.

    The main difference between them- User Control is a page file with extension . ascx which can only be used within a single application or project But custom controls are assemblies(dll files) that can be used in multiple applications.

    The main difference between User Control, Custom Control and Component is that they inherit from different levels in the inheritance treeUser Control is a page file with extension .ascx which can only be used within a single application or project But custom controls are assemblies(dll files) that can be used in multiple applications.