asp gridview Print
<p>I have a javascript function as shown below that is working. Note - i did change the line (from the internet examples)          </p>

<pre><code>WinPrint.document.write(printContent.innerHTML);
</code></pre>

<p>to</p>

<pre><code>WinPrint.document.write(printContent.outerHTML);
</code></pre>

<p>i dont think i am supposed to do that but with innerhtml the grid wasnt formatted at all but with the value outerhtml it was fine...</p>

<p>So to summarize </p>

<ol>
<li>why cant i use innerhtml like all the examples show - must be a bug
in my code somewhere </li>
</ol>

<p>thanks,
Damo</p>

<p><strong>Javascript</strong></p>

<pre><code>    &lt;script type="text/javascript"&gt;
    function PrintGridData(GridToPrint) {

        var printContent = document.getElementById(GridToPrint);
        var windowUrl = 'about:blank';
        var UserLoggedIn = $("#lblUser").text()

        var now = new Date();
        var strDateTime = [[AddZero(now.getDate()), AddZero(now.getMonth() + 1), now.getFullYear()].join("/"), [AddZero(now.getHours()), AddZero(now.getMinutes())].join(":"), now.getHours() &gt;= 12 ? "PM" : "AM"].join(" ");

        var windowName = 'Report';
        var AuditPrintDetail = 'Report ' + UserLoggedIn + " "  + strDateTime;


        var WinPrint = window.open(windowUrl, windowName, 'left=300,top=300,right=500,bottom=500,width=1000,height=500');
        WinPrint.document.write('&lt;' + 'html' + '&gt;&lt;head&gt;&lt;link href="cssreference" rel="stylesheet" type="text/css" /&gt;&lt;link href="assets/css/Main.css" rel="stylesheet" type="text/css" /&gt;    &lt;title&gt;' + AuditPrintDetail + '&lt;/title&gt; &lt;/head&gt;&lt;' + 'body  style="background:none !important"' + '&gt;');
        WinPrint.document.write(printContent.outerHTML);
        WinPrint.document.write('&lt;' + '/body' + '&gt;&lt;' + '/html' + '&gt;');
        WinPrint.document.close();
        WinPrint.focus();
        WinPrint.print();
        WinPrint.close();

    }


    function AddZero(num) {
        return (num &gt;= 0 &amp;&amp; num &lt; 10) ? "0" + num : num + "";

    }
</code></pre>
