What is the difference between UserControl, WebControl, RenderedControl and CompositeControl?

What is the difference between UserControl, WebControl, RenderedControl and CompositeControl?

UserControl: A custom control, ending in .ascx, that is composed of other web controls. Its almost like a small version of an aspx webpage. It consists of a UI (the ascx) and codebehind. Cannot be reused in other projects by referencing a DLL.

WebControl: A control hosted on a webpage or in a UserControl. It consists of one or more classes, working in tandem串联的, and is hosted on an aspx page or in a UserControl. WebControls don't have a UI "page" and must render their content directly. They can be reused in other applications by referencing their DLLs.

RenderedControl: Does not exist. May be synonymous to WebControl. Might indicate the control is written directly to the HttpResponse rather than rendered to an aspx page.

CompositeControl: Inbetween UserControls and WebControls. They code like UserControls, as they are composed of other controls. There is not any graphical UI for control compositing, and support for UI editing of CompositeControls must be coded by the control designer. Compositing is done in the codebehind. CompositeControls can be reused in other projects like WebControls.  

扩展阅读

System.Web.UI.UserControl

System.Web.UI.WebControls.WebControl

System.Web.UI.WebControls.CompositeControl

原文地址:https://www.cnblogs.com/chucklu/p/10832536.html