Is there a simple process to convert an user control to a web/composite control?
There's no automatic process, no. Here's the (general) steps to follow though:
Create a webcontrol class. Make it inherit from
Panel
if you want to take the easy way, or else override theRender()
method if you want to generate your HTML the long, verbose way.Duplicate the layout of the user control by adding html literals and other controls into the Controls collection during Init() or in the constructor for your control class. If you chose to override
Render()
, you'll need to recursively render the controls.Copy event handling code-behind from your usercontrol into your class, and wireup the event handlers.
Deal with javascripts/css. You can embed them into your assembly as web resources, or register them as regular includes using
ClientScriptManager
orScriptManager
.