c# - Print content of a javascript tabcontrol: Gridviews -
i've got jquery tabcontrol (4 tabs), each of them control 1 gridview. got button "print". activates javascriptfunction, should build page, containing gridviews. got something, not work:
function doprintpage() { mywindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scrollbars=yes,width=500,height=600'); mywindow.document.open(); mywindow.document.writeln("<link href='/styles/layout.css' type='text/css' rel='stylesheet' ></link>"); mywindow.document.write(document.getelementbyid('tabcontainer').innerhtml); mywindow.document.close(); mywindow.focus(); mywindow.print(); return true; }
i thought may getelementbyid()
, 'tabcontainer' (which contains tabs) or 'tabcontent' (the content of each tab) or 'gridview1' or something, wrong. ain't got clue...
solution:
function doprintpage() { mywindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scrollbars=yes,width=800,height=600'); mywindow.document.open(); mywindow.document.write("</br>"); mywindow.document.write("<h2>results</h2>"); mywindow.document.write(document.getelementbyid('tab1').innerhtml); mywindow.document.write("</br>"); mywindow.document.write("<h2>tree</h2>"); mywindow.document.write(document.getelementbyid('tab2').innerhtml); mywindow.document.write("</br>"); mywindow.document.write("<h2>open</h2>"); mywindow.document.write(document.getelementbyid('tab3').innerhtml); mywindow.document.write("</br>"); mywindow.document.write("<h2>free</h2>"); mywindow.document.write(document.getelementbyid('tab4').innerhtml); mywindow.document.close(); mywindow.focus(); //mywindow.print(); //mywindow.close(); return true; }
the seperate gridviews embedded in div's ("tab#"), embedded in tabcontainer. simple solution... select correct div id... apparantly overlooked one
Comments
Post a Comment