Is it just me, or do Microsoft developers have a chronic inability to understand web semantics? I.E. Use markup that makes sense and not abuse it for layout purposes?
Or why else would they insist on baking in tables into every WebPart and WebPartZone? And when I say baked in, I really mean it. It’s so far ingrained that it’s near impossible to strip it bare and still have some meaningful functionality before a deadline.
If you’re starting from scratch using an MS best practices set, forget it!
Even MS’ own semi-thought out mess to fix it, the “CSS Friendly Control Adapters”, are of no help, since they are limited to mucking other controls. If you want to know why I feel this way about the adapters, take a read at one of my earlier ramblings on the topic.
Suffice it to say, if you intend to make your layouts table-free, you may want to overlook WebPart functionality. Unless of course, you want create your own WebParts.
So I have a choice between stripping out everything and implementing my own inherited WebPart controls or simply creating a set of custom UserControls that mimic the functionality. Oh goody!
I may just go ahead and do that and post my code here. Meanwhile, if someone at Microsoft happens to come across this post, I created a demo of how I would like WebParts to behave. And yes, you can make it do what you want without using tables. I’m using my “Nova” theme that I created for my previous, “Recycle your layouts!“, post.
In keeping with my trend of not double checking any of my code I post here ;) … I put this up within an hour of setting aside a project after I ran into the table issue. There are probably a million different, and better, ways of doing this, but I just wanted to show how WebParts should behave.
Yes, there are glitches. And yes, you may want WebParts to behave differently, but you get the rough idea. I would recommend minimizing the content before moving.
Now, it’s 1:09am (or 21318.104.22.168 according to the scientific datestamp) and I’m going to bed!