When would you use a Web User Control over a Web Custom Control?
asp.net, client-side, controls, web-user-controls
Solution
This is from Microsoft's site:
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
http://msdn.microsoft.com/en-us/library/aa651710(VS.71).aspx
Problem
Can someone explain when to use each of these? They almost seem interchangeable in many cases. The Custom Control gets added to the toolbar while the User Control (ascx) can not. The Custom Control does not get rendered in the Designer while the User Control does. Beyond that, how do you choose which is the right one to use? Also, I am looking for the best way to access the controls from JavaScript (GetElementById). So, a point in the right direction for adding client side support would be great.