« Integrating PayPal Payments into E-Commerce Applications with ASP.NET | Shifted to the new home. »

ASP.NET Web User Controls VS. Web Custom Controls

by Vahid 3. March 2009 03:54

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.

considering the kind of flexibility we get from web custom controls, i believe most of the times it would be much better to use custom controls.

Web user controlsWeb custom controls
Easier to createHarder to create
Limited support for consumers who use a visual design toolFull visual design tool support for consumers
A separate copy of the control is required in each applicationOnly a single copy of the control is required, in the global assembly cache
Cannot be added to the Toolbox in Visual StudioCan be added to the Toolbox in Visual Studio
Good for static layoutGood for dynamic layout

.Net | Technical

Comments (0)

Related posts

Differences between asp.net web Site and asp.net Web ApplicationHave ever wondered what the differences between 2 types of asp.net web projects in visual studio 200…Assign a static port to Asp.net Websiteshows how to assing a static port to asp.net website projectCustomizing Entity Framework Classes in VS 2010  need to know about new cool features in visual studio 2010? check this link which describes …

Powered by BlogEngine.NET 1.6.0.0
Theme by Mads Kristensen