Horizontally align rows in multiple tables using web user control

Posted by goku_da_master on Stack Overflow See other posts from Stack Overflow or by goku_da_master
Published on 2010-05-13T16:41:30Z Indexed on 2010/05/13 16:44 UTC
Read the original article Hit count: 334

I need to align rows in different tables that are layed out horizontally. I'd prefer to put the html code in a single web user control so I can create as many instances of that control as I want and lay them out horizontally. The problem is, the text in the rows needs to wrap. So some rows may expand vertically and some may not (see the example below). When that happens, the rows in the other tables aren't aligned horizontally. I know I can accomplish all this by using a single table, but that would mean I'd have to duplicate the name, address and phone html code instead of dynamically creating new instances of my user control (in reality there are many more fields than this, but I'm keeping it simple). Is there any way to do this whether with div's, tables or something else?

Here's the problem: Mary Jane's address field expands 2 lines, causing her phone field to not align properly with John's and Bob's.

Name:  John Doe           Name: Mary Jane                   Name: Bob Smith 
Address: 123 broadway     Address: Some really long address Address: Short address 
Phone: 123-456            that takes up multiple lines      Phone: 111-2222 
                          Phone: 456-789

I'm not restricted in any way how to do this (other than using asp.net), but I'd prefer to use a single web control that I instantiate X times at design time (in this example, it's 3 times). I'm using VS2008, and .Net 3.5

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET