What are the differences between User Controls, Server Controls & Custom Controls?

IAmAN00B picture IAmAN00B · Jun 15, 2009 · Viewed 18.8k times · Source

I thought I had reasonable answers for this question at a recent interview, but I bombed it. :(

  • What are the major differences between the three?
  • If not obvious by the answer to the previous bullet, when would you choose one over the other?

Answer

JoshBerke picture JoshBerke · Jun 15, 2009
  • User Controls are controls built with a designer within a web project. They typically are only private to a web application (Although there are ways you can make them available to other projects).

  • Server Controls are controls that are also known as Web Controls. These are reusable controls that render their html without the aid of a designer, they are created in a seperate assembly from the web application, are appropiate for controls which will be used in many different web applications

  • Composite Controls are a sub type of Web Controls and are controls which are made up (composed) of other web controls.

I've never heard of a custom control to mean anything other then a control which is custom built by you or your team. And it could include user, web or composite controls.