Quantcast
Channel: CSharp Forum Latest Questions
Viewing all articles
Browse latest Browse all 32756

Printing gridview header on each page

$
0
0

Hi, I have added a print button to my web page which when pressed will print a grid view. However when printed the grid runs over multiple pages and the grid view header only appears on the first page.

I want the header to appear on each page and I would also like to add a title to the grid view which will also appear on each print out. I'm not sure how I would achieve this, is there a simple solution?

Below is the code which I am using to print the grid view:

<script type="text/javascript" >

   function printItn() {

         var prtGrid = document.getElementById('<%=GridView1.ClientID %>');

     

prtGrid.border = 1;

var prtwin = window.open('', 'PrintGridViewData', 'left=100,top=100,width=1000,height=1000,tollbar=0,scrollbars=1,status=0,resizable=1');

prtwin.document.write(prtGrid.outerHTML);

prtwin.document.close();

prtwin.focus();

prtwin.print();

prtwin.close();

        }

   </script>
  

<asp:Button ID="btnPrint" Runat="server" Text="Print Results " OnClientClick="printItn();"
        onclick="btnPrint_Click"

Thank you for your help in advance.

Viewing all articles
Browse latest Browse all 32756

Trending Articles