What is the difference, what is the official terms, are any terms obsolete in ASP.NET 3.5?
-
possible duplicate of [\[ASP.NET\] What are the differences between User Controls, Server Controls & Custom Controls?](http://stackoverflow.com/questions/994009/asp-net-what-are-the-differences-between-user-controls-server-controls-custo) – Earlz Aug 27 '10 at 19:45
-
@Earlz: 2 of the 3 components that question asks about are different from the ones asked about here. Also, this question is much older. – Bill the Lizard Aug 27 '10 at 20:08
-
@Bill ah they looked like exact dupes to me. Maybe a merging is in order? Also you're the first moderator to have actually given me a response to a flag :) – Earlz Aug 27 '10 at 22:28
5 Answers
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.

- 28,949
- 7
- 62
- 78
-
Actually a Composite control does NOT have a UI - you rely entirely on filling its Controls collection with other controls. Rendered controls are a kind of composite controls where you do not reuse other controls but merly override the Render method to output pure text (html) – Per Hornshøj-Schierbeck Sep 17 '08 at 20:13
-
I double checked my reference and clarified my CompositeControl definition, thanks. But I cannot find any official mention of a RenderedControl in MSDN documentation. Do you have a link on that? I agree on your assessment of what it probably means... – Apr 20 '09 at 13:18
-
@Will, regarding UserControl, it can be reused by referencing a DLL (control need to be Emdedded into DLL for that). Please verify your answer. – ajukraine Jun 05 '13 at 11:45
-
2@ajukraine: This answer is almost five years old, and therefore only applies to the state of asp.net at that time. If they have fixed this, good. – Jun 05 '13 at 12:47
You've forgotten the ServerControl.
In my understanding it is like that:
- There are only two different kind of controls: UserControl and ServerControl
- CompositeControls are kind of "advanced" UserControls. Find some more info on Scott Guthries Blog.
- All of them are WebControls (because they are all derived from System.Web.UI.Control)
- They are all rendered in any way so i would like to see them all as rendered controls.
From MSDN:
User Control
In ASP.NET: A server control that is authored declaratively using the same syntax as an ASP.NET page and is saved as a text file with an .ascx extension. User controls allow page functionality to be partitioned and reused. Upon first request, the page framework parses a user control into a class that derives from System.Web.UI.UserControl and compiles that class into an assembly, which it reuses on subsequent requests. User controls are easy to develop due to their page-style authoring and deployment without prior compilation.
Server control
A server-side component that encapsulates user interface and related functionality. An ASP.NET server control derives directly or indirectly from the System.Web.UI.Control class. The superset of ASP.NET server controls includes Web server controls, HTML server controls, and ASP.NET mobile controls. The page syntax for an ASP.NET server control includes a runat="server" attribute on the control's tag. See also: HTML server control, validation server controls, Web server control.

- 5,854
- 5
- 32
- 37
-
UserControl != CompositeControl. http://weblogs.asp.net/scottgu/archive/2006/01/29/436854.aspx – Sep 16 '08 at 11:08
-
Yep, you are right. I've learned something today. I have changed that in my answer. – JRoppert Sep 16 '08 at 21:04
-
I don't think this is quite right. UserControl and WebControl are both types of Server Control. (In the text you quote it actually says that UserControl is a Server Control). I think perhaps a "Server Control" just means any control with runat=server. Also, UserControl is not a WebControl. UserControl inherits from TemplateControl which inherits from Control, whereas WebControl is a different class that Inherits from Control. CompositeControl inherits from WebControl, but implements INamingContainer and ICompositeControlDesignerAccessor which make it more like a UserControl. – Tim Goodman Feb 17 '10 at 20:02
-
Then again, I could be mistaken in using the WebControl *class* as synonymous for "Web Control" (with a space) . . . adding confusion, some pages on MSDN (see http://msdn.microsoft.com/en-us/library/aa651710(VS.71).aspx) use the terms "Web User Control" to refer to "UserControl" and "Web Custom Control" to refer to "WebControl". I've just double checked and these longer names are also what's used in the VS Templates (when I Add Item... in Solution Explorer) – Tim Goodman Feb 17 '10 at 20:15
Like Web Forms, user controls can be created in the visual designer or they can be written with code separate from the HTML. They can also support execution events. However, since Web user controls are compiled dynamically at run time they cannot be added to the Toolbox and they are represented by a simple placeholder when added to a page.
This makes Web user controls harder to use if you are accustomed to full Visual Studio .NET design-time support, including the Properties window and Design view previews. Also the only way to share the user control between applications is to put a separate copy in each application, which takes more maintenance if you make changes to the control.
Web custom controls are compiled code, which makes them easier to use but more difficult to create. Web custom controls must be authored in code. Once you have created the control you can add it to the Toolbox and display it in a visual designer with full Properties window support and all the other design-time features of ASP.NET server controls. In addition you can install a single copy of the Web custom control in the global assembly cache and share it between applications, which make maintenance easier.

- 31
- 1
Contrary to Will's response, it is possible to reuse UserControls in other projects by referencing a web deployment project.

- 3,006
- 1
- 19
- 31
-
http://www.cmswire.com/cms/tips-tricks/aspnet-reusing-web-user-controls-and-forms-000915.php – banging Sep 18 '15 at 22:41
Since I don't have enough reputation yet to comment, I'll add this as an answer, but it refers to Will's answer above.
From the link you included:
Composite controls are the right tool to architect complex components in which multiple child controls are aggregated and interact among themselves and with the outside world. Rendered controls are just right for read-only aggregation of controls in which the output doesn't include interactive elements such as drop-down or text boxes.
I believe the documentation is refering to UserControls that have been created by overriding the Render method as Rendered Controls. Thus, it is not a separate type as the question implies, but a way of implementing a UserControl; a pattern.

- 3,654
- 1
- 26
- 47