Now these days I am working for the SharePoint 2010 internet facing or public facing publishing site. No doubt's we are using the OOTB publishing features of the SharePoint 2010 publishing, content types, approval workflows etc.
Well, in that site I am developing the custom web parts for the site in the Visual Studio 2010 version 10.0.30319.1 RTMRel. In this or before VS 2010 we have the .net framework 3.0 in which HtmlGenericControl which is present in the System.Web.UI.HtmlControls namespace. It will help us to build the custom UI for the web part instead of maintaining HTML in the web part and render to output(HTMLTextWriter).
You can create any of the HTML tag from HtmlGenericControl this like div, table, table row, table column and that will be very easy to manage in the code.
How this will work ?
In the code we have to add reference for the control and declare the HtmlGenericControl control in the class like :
HtmlGenericControl divSponser_Blogs_Contatiner;In the CreateChildControl or any method where you are creating the UI for the web part you can instantiate it.
divSponser_Blogs_Contatiner = new HtmlGenericControl("div");You can also set its properties like CSS class or its attributes in the control after instantiate.
divSponser_Blogs_Contatiner.Attributes.Add("class", "Sponser-Blogs-Contatiner");or like
divSponser_Blogs_Contatiner.Attributes.Add("id", "Sponser_Blogs_Contatiner");if you wnat to create table from HtmlGenericControl then you have to just replace div with table.
divSponser_Blogs_Contatiner = new HtmlGenericControl("table");Well this post will help you to create rich UI web parts for the SharePoint and it will also make easy to mage and create the custom web parts from the .net framework.