I have a javascript function which get datagrid's header into THEAD tags. This code triggered on body onload event and run correctly.
However, when i look to view source, i can't see these dynamicly generated codes. I want to see it there. How can I do it?
function AddTHEAD(tableName)
{
var table = document.getElementById(tableName);
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]);
}
}
Edit: I want to talk about why I need this: With the function above, I want Datagrid's header to be shown on every page when I print the page.
For this purpose I have css code below. When I add THEAD tag manually, it works fine. But when it's created by Javascript, it's seen on print preview but not on real printing.
tHead
{
display : table-header-group;
}
Edit2: I found a clue. When I firstly open print preview page and then click the print button there, it works. But when I directly clik the print button which run window.print javascript code, it don't works. Can anyone has a solution about it?