Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Aligning tables

Reply
Thread Tools

Aligning tables

 
 
Griff
Guest
Posts: n/a
 
      02-08-2006
I've a (classic) ASP web page that has several tables on it that have
identical columns (headings).

When these tables are displayed they of course have different widths, based
upon the amount of text within each column.

I have been asked to make all tables have identical column widths.

What I thought I would do would be to have some sort of column-width counter
that counted the maximum number of characters in column A in all tables, and
another for column B in all tables. From this I would have to come up with
some algorithm (not yet done) to turn the number of characters into a column
width (based upon font family and font size chosen). This value would then
be put into a programmatically generated style sheet. However, a quick
prototype shows that the style sheet appears to be ignored if it's at the
end of the document (even if in a <head/> tag) and the aforementioned
algorithm would appear to be rather complicated....

So - I'm after a new approach. I don't want to make it into one big table
because I've sections of information that appear between the tables.

Could I do something in JavaScript on the Client's machine?

All thoughts most welcome.

Thanks

Griff


 
Reply With Quote
 
 
 
 
McKirahan
Guest
Posts: n/a
 
      02-08-2006
"Griff" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> I've a (classic) ASP web page that has several tables on it that have
> identical columns (headings).
>
> When these tables are displayed they of course have different widths,

based
> upon the amount of text within each column.
>
> I have been asked to make all tables have identical column widths.
>
> What I thought I would do would be to have some sort of column-width

counter
> that counted the maximum number of characters in column A in all tables,

and
> another for column B in all tables. From this I would have to come up

with
> some algorithm (not yet done) to turn the number of characters into a

column
> width (based upon font family and font size chosen). This value would

then
> be put into a programmatically generated style sheet. However, a quick
> prototype shows that the style sheet appears to be ignored if it's at the
> end of the document (even if in a <head/> tag) and the aforementioned
> algorithm would appear to be rather complicated....
>
> So - I'm after a new approach. I don't want to make it into one big table
> because I've sections of information that appear between the tables.
>
> Could I do something in JavaScript on the Client's machine?
>
> All thoughts most welcome.
>
> Thanks
>
> Griff
>
>


Consider tables within tables.

<html>
<head>
<title>tables.htm</title>
</head>
<body>
<table border="0" width="400">
<tr>
<td>
<table border="1" width="100%">
<tr>
<th width="25%">col 1<hr></th>
<th width="25%">col 2<hr></th>
<th width="25%">col 3<hr></th>
<th width="25%">col 4<hr></th>
</tr>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
<td>Four</td>
</tr>
<tr>
<td colspan="4">
<br>Stuff between the tables.<br><br>
</td>
</tr>
<tr>
<th>col 1<hr></th>
<th>col 2<hr></th>
<th>col 3<hr></th>
<th>col 4<hr></th>
</tr>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
<td>Four</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

The first row in the second table identifies the width of the columns.

Unless you use a proportional font (like Courier) then counting
characters will yield inaccurate results as "iii" is narrower than "XXX".


 
Reply With Quote
 
 
 
 
Larry Bud
Guest
Posts: n/a
 
      02-10-2006

Griff wrote:
> I've a (classic) ASP web page that has several tables on it that have
> identical columns (headings).
>
> When these tables are displayed they of course have different widths, based
> upon the amount of text within each column.
>
> I have been asked to make all tables have identical column widths.
>
> What I thought I would do would be to have some sort of column-width counter
> that counted the maximum number of characters in column A in all tables, and
> another for column B in all tables. From this I would have to come up with
> some algorithm (not yet done) to turn the number of characters into a column
> width (based upon font family and font size chosen). This value would then
> be put into a programmatically generated style sheet. However, a quick
> prototype shows that the style sheet appears to be ignored if it's at the
> end of the document (even if in a <head/> tag) and the aforementioned
> algorithm would appear to be rather complicated....
>
> So - I'm after a new approach. I don't want to make it into one big table
> because I've sections of information that appear between the tables.
>
> Could I do something in JavaScript on the Client's machine?


You can't count characters because the width of the text will appear
different on different machines.

Not sure your problem with one big table, it's probably the only way
that you're going to get away with this.

For the stuff between tables, just merge the row into 1 big row. If
you want the "table" portions bordered, you can apply that to each
cell. The user won't be able to tell if it's in 1 table or not.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Aligning tables without masterpage Bill ASP .Net 0 11-19-2008 12:32 AM
How to get database metadata information (i.e. existing tables and columns in tables) Chris Brat Python 5 08-22-2006 05:25 PM
Tables within tables Otuatail HTML 7 08-02-2004 04:42 AM
Aligning Signals ALuPin VHDL 3 04-21-2004 05:32 AM
Text after 2 tables actually appears between 2 tables ! Peter Bassett HTML 3 08-15-2003 06:46 PM



Advertisments