Avatar of Mel Parish
Mel Parish
Flag 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.
ASPVB Script

Avatar of undefined
Last Comment
Mel Parish

8/22/2022 - Mon
Walter Ritzel

Can you share your current code?
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

Walter Ritzel

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Big Monty

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
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Mel Parish

Perfect!  Many thanks!!
Mel Parish

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.