Link to home
Start Free TrialLog in
Avatar of Mel Parish
Mel ParishFlag for United States of America

asked on

table header row every 10 lines

I have a huge table and I need to add the header row every 10 lines so when the user scrolls down, they don't lose the header.  I have some code to scroll lock, but i need this quick fix first.  this table loops through data from a mssql database.  Many thanks in advance.
Avatar of Walter Ritzel
Walter Ritzel
Flag of Brazil image

Can you share your current code?
Avatar of Mel Parish


so about every 10th record I need to include the heading

<%rs=objConn.execute("select * from mytable")%>
<tr><th>Heading 1</th><th>Heading 2</th><th>Heading 3</th></tr>
<%if not rs.eof then
do while not rs.eof
response.write "<tr><td>" & value 1 & "</td><td>" & value 2 & "</td><td>" & value 3 & "</td></tr>"
end if

Open in new window

Avatar of Walter Ritzel
Walter Ritzel
Flag of Brazil image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you're better off going with a fixed header. if you have visitors to your site with different screen resolutions, what may look right for one visitor (putting the header row every 10th line) will look very off for another visitor. The time it takes you to implement this solution would be very nearly the same time it would take to put in a css based fixed header solution.

here's a pretty straightforward tutorial on how to add css to your table to make a fixed header:

if you use jquery at all, you may want to look into datatables if you want more feautures, such as sorting, searching, paging etc
Perfect!  Many thanks!!
Big Monty, you are correct and I do have some code, but I needed a quick fix.  My headers are very involved with a lot of if statements for the groups they target and this was the fix i needed to get me through a meeting this morning.  thank you.