asp.netcontrolsweb-controlscomposite-controls

Which control to choose? WebControl or CompositeControl that is the question


I'm looking forward to create some customs controls like AutoCompletes, TagClouds and others. To use in my projects as tools without need to worry every time that i need one of them.

i saw in This link

that i have 2 choices.

- WebControl

- CompositeControl

Those two, they can be reused in other applications.

i read some docs and i'm really in doubt, which should i choose ?


Solution

  • It will depend on how you will implement these controls. If they will be composed of two or more controls (a textbox and a dropdownlist, two textboxes ... etc), then using a Composite Control would be easiest. However, if you are extending the functionality of just one control, or manually outputting the HTML, then use WebControl