1

I am trying to print Header & footer on Every page using HTML's Thead Tag in Asp.net. when I try with a Logo or image using Div in thead tag it works. But when I try with a table, in thead tag then it doesn't work.

CSS:

I am using the below method

@media print {
 thead { display: table-header-group; }
 tfoot { display: table-footer-group; }
}
@media screen {
 thead { display: block; }
 tfoot { display: block; }
}

    <table style="width:100%">
       <thead>
        <tr>
          <th>record1</th>
        </tr>
       </thead>
     <tbody>
     </tbody>
</table>
working But I need to using

 <table style="width:100%">
           <thead>
            <tr>
              <th><table>
<tr><td>Name</td><td>Label</td></tr></table></th>
            </tr>
           </thead>
         <tbody>
         </tbody>
</table>

I need to know this information and logo shown on each page but after adding this information, they gave the margin. Please Review screenshots below https://i.stack.imgur.com/L0ZTs.jpg

https://i.stack.imgur.com/Z1OsI.png

Anshul Riyal
  • 123
  • 1
  • 12
Vikas
  • 17
  • 10
  • why do you want to put an inner table inside the th? What is the purpose of that? – ADyson May 09 '19 at 11:15
  • P.S. It's unclear what we are supposed to be looking at in your screenshots? What precisely is the issue? What is not working, specifically? Please describe it more clearly. Can you also show us a "working" output to compare it to? Thanks. – ADyson May 09 '19 at 11:17
  • Respected Sir @ADyson please review this screenshot https://imgur.com/a/BsPJ60J I need print this information on each page in the header but here is Problem if I remove hr line from above IPD No it will show on every page or if we not remove hr line from there then I must remove UHID and Discharge Date then it will show on each page. in simple language, if I try to show both then header not repeat on each page. sorry for my English – Vikas May 09 '19 at 11:32
  • before you spoke about tables, now you speak about hr lines (which aren't shown in your code above)...it's still not clear what part is the problem. You said it works ok if you don't include a table inside the main table. How does hr lines relate to that? – ADyson May 09 '19 at 11:35
  • P.S. Maybe this article will help you: https://stackoverflow.com/questions/1360869/how-to-use-html-to-print-header-and-footer-on-every-printed-page-of-a-document – ADyson May 09 '19 at 11:36
  • ok let me explain i have already attache a screenshot in comment section. i need to logo and patient details on each page during print out. on header but its not working 1 hour before i think its not work becuase of inner table but no if i need to print this on each page header i must remove there to on tr Td tag means must remove Name section, or uhid or IPD No then it will work and show on every page but if we try to show with alll content then it will not work – Vikas May 09 '19 at 11:37
  • Thank you Sir for your valuable time and helpful link thank you so much – Vikas May 09 '19 at 11:44

0 Answers0