What is different between Web User Control and Web Custom
Control?

Answer Posted / guest

Web custom controls are compiled components that run on the
server and that encapsulate user-interface and other related
functionality into reusable packages. They can include all
the design-time features of standard ASP.NET server
controls, including full support for Visual Studio design
features such as the Properties window, the visual designer,
and the Toolbox.
There are several ways that you can create Web custom controls:
? You can compile a control that combines the functionality
of two or more existing controls. For example, if you need a
control that encapsulates a button and a text box, you can
create it by compiling the existing controls together.
? If an existing server control almost meets your
requirements but lacks some required features, you can
customize the control by deriving from it and overriding its
properties, methods, and events.
? If none of the existing Web server controls (or their
combinations) meet your requirements, you can create a
custom control by deriving from one of the base control
classes. These classes provide all the basic functionality
of Web server controls, so you can focus on programming the
features you need.
If none of the existing ASP.NET server controls meet the
specific requirements of your applications, you can create
either a Web user control or a Web custom control that
encapsulates the functionality you need. The main difference
between the two controls lies in ease of creation vs. ease
of use at design time.
Web user controls are easy to make, but they can be less
convenient to use in advanced scenarios. You develop Web
user controls almost exactly the same way that you develop
Web Forms pages. Like Web Forms, user controls can be
created in the visual designer, they can be written with
code separated from the HTML, and they can handle execution
events. However, because Web user controls are compiled
dynamically at run time they cannot be added to the Toolbox,
and they are represented by a simple placeholder glyph 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, however, 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 makes maintenance easier.

Web user controls
--------------------
Easier to create
Limited support for consumers who use a visual design tool
A separate copy of the control is required in each application
Cannot be added to the Toolbox in Visual Studio
Good for static layout


Web custom controls
-------------------------
Harder to create
Full visual design tool support for consumers
Only a single copy of the control is required, in the global
assembly cache
Can be added to the Toolbox in Visual Studio
Good for dynamic layout

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Please explain what are an object and a class?

522


What are the security policy levels in .Net

1567


Is .net core stable?

491


Explain what are an object and a class?

562


Compare client server application with n-tier application

504






What is managed code execution?

596


How to implement datagrid in.net? How would you make a combo-box appear in one column of a datagrid? What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for datagrid methods. What is the access specifier used for that methods in the code behind file and why?

544


What is a serviced component?

571


What tools can I use to develop .net applications?

568


What is the difference between web application and enterprise application?

563


What is new in .net core?

478


What is iis? Have you used it?

562


As you know read-only variables and constants have many similarities, but what is at least one way that they differ?

528


What is the concept of inheritance in .net?

597


Tell us what is heap and what is stack?

559