SmartPart v3: Building Custom Web Parts from User Controls (.ascx)

For those of us writing Web Parts for WSS v3, we know that we have 2 choices.  We can create an ASP.NET v2 Web part, a precompiled .NET class that inherits from the ASP.NET v2 WebPart class, or we can create a class which inherits from the WSS v3 WebPart class.  Generally, the former is recommended because they can be used in any ASP.NET v2 Web application, .....duh this now includes WSS v3.    This is awesome!!

Historically, there has been some grumbling about creating custom Web parts because the visual designer provides little assistance, unlike the process for creating user controls.  So it would be great if we could build Web parts from user controls.  Unfortunately this is not a supported process OOTB in WSS v3.  However, there is a 3rd party solution: The SmartPart!....actually Son of SmartPart or SmartPart v3.  Go check it out!

For those like me who have difficulty accepting that user controls just don't work as Web Parts and need an explanation, this may help.

In ASP.NET v2, developers can create controls that don't inherit from the WebPart class and add them to ASP.NET v2 Web Part Zones.  At execution, the runtime engine will wrap the control inside the GenericWebPart class.  This allows ASP.NET v2 developers to create user controls (ascx files) and have them be treated like Web Parts.  Unfortunately, WSS v3 does not contain the GenericWebPart class and only code that inherits from either the ASP.NET v2 WebPart class or the WSS v3 WebPart class can be used in WSS v3 Web Part pages.  The GenericWebPart class and the WSS v3 WebPart class both derive from the same ASP.NET v2 WebPart class, and therefore WSS v3 knows nothing of the existence of the GenericWebPart class.