Andy Smith published a phenomenally handy code snippet on his blog which does a lot of the grunt work for generating DesignTimeHtml for Templated server controls for ASP.NET.