开发者

Header printing on every page

I have a gridview that i want to print its header on every page and i want to print a page header on every page. The problem is that one or the other works for me. I can't get both to work at the same time. Below is sample code to show what i've done.

<table>
 <tr>
  <td>
  <body onload="thead('tblheader');">
     <table id="tblheader">
        <tr id="title" >
            <td >Page HEADER</td>
        </tr>
 开发者_Go百科    </table>
</body>
   </td>
  </tr>
 <tr>
    <td>
       <body onload="AddTHEAD('claimGrid');">
        <Gridview id="claimGrid"></GridView>
        </body>
     </td>
 </tr>
 </table>

Javascript functions called ---I know both are the exact same I could have just sent the table name, but I had other code in the second function before.

function AddTHEAD(tableName) {
    var table = $get('<%=claimGrid.ClientID %>');
    if (table != null) {
        var head = document.createElement("THEAD");
        head.style.display = "table-header-group";
        head.appendChild(table.rows[0]);           
        table.insertBefore(head, table.childNodes[0]);
    }
}

function thead(tableName) {
    var table = document.getElementById('tblheader');
    if (table != null) {
        var head = document.createElement("THEAD");
        head.style.display = "table-header-group";
        head.appendChild(table.rows[0]);
        table.insertBefore(head, table.childNodes[0]);
    }
}

CSS class

 <style type="text/css">


@media print
{
    th 
    {
        color:black;
        background-color:white;
    }
    tHead
    {
    display : table-header-group;
    }

}
</style>

what am I doing wrong? If you need more info...just ask


removed the double body tags and called one function then called the other inside of the first function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜