Menu Home

Wrap Sharepoint Webpart in DIVs

This article has some code for a control adapter that can be used for just that.
http://blog.sharepoint.ch/2007/12/webpartzone-adapter.html
I does however not wrap webparts in divs, it only renders the webpart contents, which means any Chrom will be gone, as will those pesky tables that you might dislike.

If you like the tables and just want them rendered inside a DIV, which can useful for styling reasons. Then you can replace the line:
wp.RenderContents(writer);
with
wpz.WebPartChrome.RenderWebPart(writer, wp);

Obviously a better reason would be to make your own WebPartChrome implementation by inheriting from SPChrome, but since the Sharepoint class is sealed that is not really an option 🙁

Feel free to modify it as you like.

Categories: Uncategorized

Tagged as:

Simon J.K. Pedersen

Leave a Reply

Your email address will not be published. Required fields are marked *