ASP.NET tables

I have to remember to not use the Table Server Control unless it’s absolutely necessary.Once you add other controls to the table you can’t do anything with them unless you hand-edit the source. The problem is that the only control that the Properties Window sees is the table itself. Inside of that are TableRow and TableCell controls that are accessible from the Properties Window. These can then be edited with their own property pages. But a cell is not really an object container, it’s more like just a textbox, so you set the Text property of a cell equal to some HTML. In my case the HTML was a IMG tag. I couldn’t edit that image in any way, except by hand-coding the Text property of the TableCell.

I know, someone will tell me that this is exactly what these Server Controls are for – coded access into the controls via properties like “.Text”. But I was hoping VS 2005 would be smart enough 😯 to give me the choice of editing the Text property or having it render whatever was in that property through standard property pages.

The real solution of course was to drop an HTML table on the page and move everything over to it. Of course that takes manual copy/paste of source code too. And the real-real solution is to just know better for next time: If you’re just populating the cells and not manipulating the objects, then use server controls. If you need any control over the objects themselves, use an HTML table which is akin to not using any container at all.

Resizing Tables

As long as we’re here, I’ve found it very hard to figure out how to properly size tables, rows, columns, and cells by dragging the size controls on the table controls. When I move a line, dangit, I don’t want the control to resize everything else for me at the same time. I’m sure there is some switch to turn off this annoying behavior, I just haven’t found it yet.

1 thought on “ASP.NET tables

Leave a Reply