I got a JQuery printfunction:
function doPrintPage()
{
myWindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scrollbars=yes,width=800,height=600');
myWindow.document.open();
myWindow.document.write(document.getElementById("studentnummer").value);
myWindow.document.write(document.getElementById("Voornaam").value + " " + document.getElementById("Tussenvoegsel").value + " " + document.getElementById("Achternaam").value);
myWindow.document.write("</br>");
myWindow.document.write("Result");
myWindow.document.write(document.getElementById('tab1').innerHTML);
myWindow.document.write("</br>");
myWindow.document.write("Tree");
myWindow.document.write(document.getElementById('tab2').innerHTML);
myWindow.document.write("</br>");
myWindow.document.write("Open");
myWindow.document.write(document.getElementById('tab3').innerHTML);
myWindow.document.write("</br>");
myWindow.document.write("Free");
myWindow.document.write(document.getElementById('tab4').innerHTML);
myWindow.document.close();
myWindow.focus();
}
There are 3 gridviews (elements in "tab#"), and on the page that is generated by this script, eacht gridview gets a header (Results, Tree, Open, Free). It is possible that there is no gridview for "Tree". It would be nice if the "tree" header wouldn't be shown either. EDIT: I tried this:
if ($('tab4')[0]) {myWindow.document.write("Free");
myWindow.document.write(document.getElementById('tab4').innerHTML);
but it seems not to work either... Anyone knows the solution?