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.
meldraperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Walter RitzelSenior Software EngineerCommented:
Can you share your current code?
0
meldraperAuthor Commented:
so about every 10th record I need to include the heading

<%rs=objConn.execute("select * from mytable")%>
<table>
<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>"
rs.movenext
loop
end if
%></table>

Open in new window

0
Walter RitzelSenior Software EngineerCommented:
I think this should do the trick...
<%rs=objConn.execute("select * from mytable")%>
<table>
<tr><th>Heading 1</th><th>Heading 2</th><th>Heading 3</th></tr>
<% limit = 10
      cnt = 1
     if not rs.eof then
do while not rs.eof
    if cnt = 11 then
         response.write "<tr><th>Heading 1</th><th>Heading 2</th><th>Heading 3</th></tr>" 
         cnt = 1
  end if
 response.write "<tr><td>" & value 1 & "</td><td>" & value 2 & "</td><td>" & value 3 & "</td></tr>"
cnt = cnt + 1
rs.movenext
loop
end if
%></table>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Big MontyWeb Ninja at largeCommented:
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:

http://anaturb.net/csstips/sheader.htm

if you use jquery at all, you may want to look into datatables if you want more feautures, such as sorting, searching, paging etc
0
meldraperAuthor Commented:
Perfect!  Many thanks!!
0
meldraperAuthor Commented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.