title: How to print gridview with scrolling?
body: <p>I am making a gridview which uses scrolling as the column are a more than the page width of my webpage .
  The issue is when i want to print it only prints the shown data. How can i print everything in a div or panel ?</p>
  
  <p>MY CODE FOR GRIDVIEW:</p>
  
  <pre><code>&lt;a href="#" onclick="printPartOfPage('content-middle')" &gt;PRINT ME &lt;/a&gt;
  
  &lt;asp:Panel ID="gridPanel" runat="server" Height="500px" Width="980px" ScrollBars="Auto"&gt;
  
  
     &lt;asp:GridView EnableSortingAndPagingCallbacks="true" Width="450px" 
              OnRowCreated="GridView1_RowCreated" runat="server" ID="GridView2" 
            CellPadding="4" ForeColor="#333333" GridLines="None" 
              &gt;
  
                   &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
  
                   &lt;Columns&gt;
  
                       &lt;asp:HyperLinkField DataNavigateUrlFields="ID" 
                           DataNavigateUrlFormatString="updateAppointmentOperations.aspx?showID={0}" Text="Update " 
                           Target="_blank" /&gt;
                   &lt;/Columns&gt;
  
                   &lt;EditRowStyle BackColor="#999999" /&gt;
                   &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
                   &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
                   &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
                   &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
                   &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
                   &lt;SortedAscendingCellStyle BackColor="#E9E7E2" /&gt;
                   &lt;SortedAscendingHeaderStyle BackColor="#506C8C" /&gt;
                   &lt;SortedDescendingCellStyle BackColor="#FFFDF8" /&gt;
                   &lt;SortedDescendingHeaderStyle BackColor="#6F8DAE" /&gt;
  
               &lt;/asp:GridView&gt;
  
      &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>And the javascript print i got of the internet and it is:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  function printPartOfPage(elementId) {
      var printContent = document.getElementById(elementId);
      var windowUrl = 'about:blank';
      var uniqueName = new Date();
      var windowName = 'Print' + uniqueName.getTime();
      var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');
  
      printWindow.document.write('&lt;link rel="stylesheet" type="text/css" href="style/additional.css" /&gt;&lt;link rel="stylesheet" type="text/css" href="style/default.css" /&gt;&lt;link rel="stylesheet" type="text/css" href="style/hi-res.css" /&gt;' + printContent.innerHTML);
      printWindow.document.close();
      printWindow.focus();
      printWindow.print();
      printWindow.close();
  }
  </code></pre>
  
  <p></p>
  
  <p>The gridview is in a div with id content middle.</p>
  
  <p>Thank you </p>