Nisha Regil
What is difference between Custom Control and User Control?
By Nisha Regil in C# on Sep 08 2020
  • Pankaj Patel
    Sep, 2020 15

    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.

    • 1
  • Arvind Yadav
    Mar, 2022 3

    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.

    • 0
  • Dakshita Agarwal
    Sep, 2020 12

    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.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS