What are the differences between user controls, server controls, and user controls?

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

  • What are the main differences between the three?
  • If this is not obvious from the answer to the previous brand, when will you choose one after the other?
+15
controls custom-controls user-controls
Jun 14 '09 at 23:13
source share
3 answers
  • User controls are controls created by a designer as part of a web project. They are usually only private for web applications (although there are ways to make them available for other projects).

  • Server controls are controls that are also known as web controls. These are reusable controls that display their html without the help of a designer; they are created in a separate assembly from a web application; they are suitable for controls that will be used in many different web applications.

  • Composite controls are a subtype of web controls and are controls that are composed of other web controls.

I have never heard that a user control means anything other than a control that is customizable by the user or your team. And it can include custom, web, or composite controls.

+24
Jun 14 '09 at 23:23
source share

A user control is a partial web page created just like any other web page in ASP.NET, except that it has a .ASCX extension and can be embedded in other ASPX pages.

User controls are registered on the web page in which they are used, for example:

<%@ Register TagPrefix="UC" TagName="TestControl" Src="test.ascx" %> 

They are then advertised on the web page in which they are to be used, for example:

 <UC:TestControl id="Test1" runat="server"/> 

User controls are compiled code components that run on the server, expose the object model, and display markup text, such as HTML or XML, like a regular web form or user control. User controls are written in C # or VB and produced from a class

 System.Web.UI.WebControls.WebControl 

Server controls are controls that run on the server and display markup in the browser. User controls and user controls are examples of server controls.

http://support.microsoft.com/kb/893667

+7
Jun 14 '09 at 23:24
source share

The difference between web user controls and web user controls in ASP.Net.

Web User Management:

Web user controls are easy to make, but they may be less convenient to use in advanced scripts. You design web user controls in much the same way as you design web forms. Like web forms, a user control can be created in a visual designer, they can be written with code separate from HTML, and they can handle execution events. However, since web user controls are dynamically compiled at run time, they cannot be added to the toolbar, and they are displayed with a simple placeholder glyph when added to the page. This simplifies the use of web users if you are used to full support for Visual Studio.NET development time, including the Properties window and preview of project views. In addition, the only way to share user control between applications is to put a separate copy in each application, which requires additional maintenance if you make changes to the control.

Web user control:

Web user controls are compiled code, which makes them easier to use but harder to create; Web user controls must be created in code. However, by creating a control, you can add it to the toolbar and display it in the visual designer with full support for the property window and all other ASP.NET control development time features. In addition, you can install a single copy of a custom control in the global assembly cache and share it between applications for easier maintenance.

Read more ... here .

+1
Oct 24 '14 at 4:42 on
source share



All Articles