Hello,
Im trying to figure out problem i have. Ive recently created a WebPart for SharePoint with a datagridview.
Ive added a Printing Function with javascript that looks like this:
function PrintGridData() { var prtGrid = $("#<Placeholder>"); if (prtGrid != null) { prtGrid.border = 0; var prtwin = window.open('', 'PrintGridViewData', 'left=100,top=100,width=1000,height=1000,tollbar=0,scrollbars=1,status=0,resizable=1'); prtwin.document.write( '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'+ '<html><head>'+ '<link rel="stylesheet" href="<Placeholder>">' + '</head><body style="background-color:white;">' ); prtwin.document.write(prtGrid.html()); prtwin.document.write('</body></html>'); prtwin.document.close(); prtwin.focus(); prtwin.print(); prtwin.close();
Togheter with a simple ASP snippet:
<input type="button" id="btnPrint" value="Print" onclick="PrintGridData()" />
But the problem is that the DataGridView rows are all empty on the paper unlike in the preview screen.
Is there any more fancy/smarter way of doing this to get the filled rows included in the Print?
Perhaps printing it as a picture? Anyone got ideas/tips they are greatly appriciated.
/MG