Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic table row height

Status
Not open for further replies.

tjw2006

Programmer
Nov 16, 2006
103
GB
I'm using ASP to dynamically create a table from database data - what I'm trying to achieve is to be able to keep a record of each row's height as it's being created and if the sum of all the row heights goes over a certain number, to break the table, with the intention of starting a new table on another page. I've tried sending the identifier of a particular row to a Javascript function within the ASP loop after each </tr> tag, and then trying to reference that row's height using: document.getElementById(TheRow).height - but this isn't working. I've tried clientHeight, style.height, but each time it's coming out blank or with a zero. Anybody got any ideas on how I could achieve this?

Thanks
 
tjw, I really dont understand what you are trying to achieve here. Javascript wont trigger until the page has loaded. Are you just trying to add some sort of paging? If so this is much easier done server side.
 
well nickdel, this has all come about because I've been trying to find a way of printing a dynamically created table. If left as normal, because the table is so long, the table just spills over to each page, sometimes cutting rows in half or short and subsequent pages do not have the table's column headers. I thought I could find a way, using javascript to cut the table at a certain row and create a new table on the next page with the original column headers. That's the problem.

Thanks
 
tjw2006, nickdel is correct. You are going to have to handle this server-side. Your best bet would be to print out the table on paper and approximate how many rows will generally fit onto one page. When serving the table rows with ASP, count each row as it is created and if you hit the printable limit, create a new table. Sadly, client-side javascript is not going to be of any help here. It's possible that you could do something with page breaks in CSS, but I don't think it's capable of splitting a table into smaller tables so the ASP route is your best bet. I would suggest that you direct any further questions to that forum: forum333

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top