title: window.print() prints 6 empty pages before requested page
body: <p>I have a web page that contains a menu bar with 7 tabs. Right beneath the menu bar is a print button that calls the javascript window.prin() function. However, every time this button is pressed the pages for all 7 tabs get printed. Is there any way to specify exactly which page you want to print? </p>
  
  <pre><code>&lt;%@ Page Language="vb" AutoEventWireup="false" CodeBehind="DistEducation.aspx.vb" Inherits="Periscope.DistEducation" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;DistEducation&lt;/title&gt;
  
      &lt;%--Added the following three scripts for the TableSorter--%&gt;
      &lt;script type="text/javascript" src="../Scripts/jquery-1.4.1.min.js"&gt;&lt;/script&gt;  
      &lt;script type="text/javascript" src="../Scripts/jquery.tablesorter.min.js"&gt;&lt;/script&gt;
  
      &lt;script type="text/javascript"&gt;
  
          $(document).ready(function() {
              $("#grdTraining").tablesorter();
          });
          $(document).ready(function () {
              $("#grdExpTraining").tablesorter();
          });
          $(document).ready(function () {
              $("#grdProduct").tablesorter();
          });
          $(document).ready(function () {
              $("#grdExpProd").tablesorter();
          });
  
          function GridChanger() {
              var linker = document.getElementById("expTrainingShow");
              var grid = document.getElementById("expTraining");
  
              if ((grid != null) &amp; (linker != null)) {
                  if (linker.innerHTML == "+ Show Expired Continuing Education") {
                      grid.style.display = "block";
                      linker.innerHTML = "- Hide Expired Continuing Education";
                  }
                  else {
                      grid.style.display = "none";
                      linker.innerHTML = "+ Show Expired Continuing Education";
                  }
              }
  
          } //end GridChanger
  
          function GridChangerProd() {
              var linker = document.getElementById("expProdShow");
              var grid = document.getElementById("expProd");
  
              if ((grid != null) &amp; (linker != null)) {
                  if (linker.innerHTML == "+ Show Expired Product Training") {
                      grid.style.display = "block";
                      linker.innerHTML = "- Hide Expired Product Training";
                  }
                  else {
                      grid.style.display = "none";
                      linker.innerHTML = "+ Show Expired Product Training";
                  }
              }
  
          } //end GridChangerProd
  
  
          function doPrint() {
              window.print();
          }
      &lt;/script&gt;
  
      &lt;LINK href="../Stylesheets/Default.css" type="text/css" rel="stylesheet"&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
          &lt;table width="100%"&gt;
              &lt;tr&gt;
                  &lt;td width="70%" align="left"&gt;&lt;/td&gt;
                  &lt;td width="25%" align="right"&gt;&lt;asp:label id="lblTime" Runat="server" CssClass="clsLabelStatus"&gt;&lt;/asp:label&gt;&lt;/td&gt;
                  &lt;td width="5%" align="right"&gt;&lt;input id="cmdPrint" title="Print" onclick="doPrint();" type="button" value="Print" name="cmdPrint"&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
  
      &lt;div style="margin-left: 0px"&gt;
      &lt;br /&gt;
  &lt;%--    &lt;h2 style="background-position: center; background-color: #CCCCCC; font-family: Arial, Verdana, sans-serif; color: #000000; text-align: left; width: 100%;"&gt;Training and Continuing Education&lt;/h2&gt;--%&gt;
  &lt;%--        &lt;asp:Label ID="TempMessage" runat="server" Font-Bold="True" Font-Size="Large" 
              ForeColor="Red" Text="This tab will display Agent training in the near future."&gt;&lt;/asp:Label&gt;--%&gt;
          &lt;h1 class="clsSectionBar" width: 100%;" 
              style="font-size: small; height: 20px; vertical-align: middle;"&gt;Continuing Education&lt;/h1&gt;
          &lt;asp:Label ID="UserMessage" runat="server" Text="" CssClass="clsLabel"&gt;&lt;/asp:Label&gt;
          &lt;br /&gt;
          &lt;span id="expTrainingShow" class="clsLink" style="margin-left: 20px;" runat="server" onclick="GridChanger();"&gt;
              + Show Expired Continuing Education&lt;/span&gt;
  
  
          &lt;div id="expTraining" style="display:none;"&gt;
              &lt;asp:GridView 
                  AllowSorting="True"
                  ID="grdExpTraining" 
                  runat="server" BackColor="White" BorderColor="White" 
                  BorderWidth="3px" CellPadding="2" Width="98%" AutoGenerateColumns="False" 
                  HorizontalAlign="Center" Font-Names="Arial" 
                  style="margin-top: 0px" HeaderStyle-ForeColor="White"&gt;
                  &lt;RowStyle ForeColor="Black" /&gt;            
                  &lt;Columns&gt;
  
                      &lt;asp:BoundField DataField="StateCode" HeaderText="State" 
                          SortExpression="StateCode"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                      &lt;asp:BoundField DataField="CourseDesc" HeaderText="Course" 
                          SortExpression="CourseDesc"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                      &lt;asp:BoundField DataField="Hours" HeaderText="Hours" SortExpression="Hours"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                      &lt;asp:BoundField DataField="EffectiveDate" HeaderText="Effective" 
                          SortExpression="EffectiveDate" DataFormatString="{0:d}"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                      &lt;asp:BoundField DataField="ExpirationDate" HeaderText="Expiration" 
                          SortExpression="ExpirationDate" DataFormatString="{0:d}"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                  &lt;%--&lt;asp:BoundField DataField="Notes" HeaderText="Notes" 
                          SortExpression="Notes"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" Width="200" /&gt;
                      &lt;/asp:BoundField&gt; Commented out until further notice (Neal Rodruck 7/26/12)--%&gt;
  
                      &lt;asp:BoundField DataField="LastChange" HeaderText="Last Chg"
                          SortExpression="LastChange" DataFormatString="{0:d}"&gt; 
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" Width="145" /&gt;
                      &lt;/asp:BoundField&gt;
  
                  &lt;/Columns&gt;
                  &lt;FooterStyle BackColor="White" ForeColor="#000066" /&gt;
                  &lt;PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /&gt;
                  &lt;SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /&gt;
                  &lt;HeaderStyle CssClass="clsListHeading" Font-Size="Small" /&gt;
              &lt;/asp:GridView&gt;
          &lt;/div&gt;
  
          &lt;asp:GridView 
              AllowSorting="True"
              ID="grdTraining"  
              runat="server" BackColor="White" BorderColor="White" 
              BorderWidth="3px" CellPadding="2" Width="98%" AutoGenerateColumns="False" 
              HorizontalAlign="Center" Font-Names="Arial" 
              style="margin-top: 0px" HeaderStyle-ForeColor="White" &gt;
              &lt;RowStyle ForeColor="Black" /&gt;            
              &lt;Columns&gt;
  
                  &lt;asp:BoundField DataField="StateCode" HeaderText="State" 
                      SortExpression="StateCode"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
                  &lt;asp:BoundField DataField="CourseDesc" HeaderText="Course" 
                      SortExpression="CourseDesc"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
                  &lt;asp:BoundField DataField="Hours" HeaderText="Hours" SortExpression="Hours"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
                  &lt;asp:BoundField DataField="EffectiveDate" HeaderText="Effective" 
                      SortExpression="EffectiveDate" DataFormatString="{0:d}"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
                  &lt;asp:BoundField DataField="ExpirationDate" HeaderText="Expiration" 
                      SortExpression="ExpirationDate" DataFormatString="{0:d}"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
              &lt;%--&lt;asp:BoundField DataField="Notes" HeaderText="Notes" 
                      SortExpression="Notes"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" Width="200" /&gt;
                  &lt;/asp:BoundField&gt; Commented out until further notice (Neal Rodruck 7/26/12)--%&gt;
  
                  &lt;asp:BoundField DataField="LastChange" HeaderText="Last Chg"
                      SortExpression="LastChange" DataFormatString="{0:d}"&gt; 
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" Width="145" /&gt;
                  &lt;/asp:BoundField&gt;
  
              &lt;/Columns&gt;
              &lt;FooterStyle BackColor="White" ForeColor="#000066" /&gt;
              &lt;PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /&gt;
              &lt;SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /&gt;
              &lt;HeaderStyle CssClass="clsListHeading" Font-Size="Small" /&gt;
          &lt;/asp:GridView&gt;
          &lt;br /&gt;
          &lt;h1 class="clsSectionBar" width: 100%;" 
              style="font-size: small; height: 20px; vertical-align: middle;" 
              id="prodInfo" &gt;Product Training&lt;/h1&gt;
          &lt;asp:Label ID="ProductMessage" runat="server" Text=""&gt;&lt;/asp:Label&gt;
          &lt;br /&gt;
  
                  &lt;span id="expProdShow" class="clsLink" style="margin-left: 20px;" runat="server" onclick="GridChangerProd();"&gt;
              + Show Expired Product Training&lt;/span&gt;
  
          &lt;div id="expProd" style="display:none;"&gt;
              &lt;asp:GridView 
                  AllowSorting="True"
                  ID="grdExpProd"
                  runat="server" BackColor="White" BorderColor="White" 
                  BorderWidth="3px" CellPadding="2" Width="98%" AutoGenerateColumns="False" 
                  HorizontalAlign="Center" Font-Names="Arial" 
                  style="margin-top: 0px" HeaderStyle-ForeColor="White"&gt;
                  &lt;RowStyle ForeColor="Black" /&gt;            
                  &lt;Columns&gt;
  
                      &lt;asp:BoundField DataField="Partner" HeaderText="Partner"
                          SortExpression="Partner"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                      &lt;asp:BoundField DataField="ProductDesc" HeaderText="Product"
                          SortExpression ="ProductDesc"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                      &lt;asp:BoundField DataField="DateTaken" HeaderText="Date Taken" 
                          SortExpression="DateTaken" DataFormatString="{0:d}"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                      &lt;asp:BoundField DataField="DateExpired" HeaderText="Date Expired" 
                          SortExpression="DateExpired" DataFormatString="{0:d}"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                      &lt;asp:BoundField DataField="CourseDesc" HeaderText="Course"
                          SortExpression="CourseDesc"&gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                      &lt;asp:BoundField DataField="Status" HeaderText="Status" 
                          SortExpression="Status" &gt;
                          &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                      &lt;/asp:BoundField&gt;
  
                  &lt;/Columns&gt;
                  &lt;FooterStyle BackColor="White" ForeColor="#000066" /&gt;
                  &lt;PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /&gt;
                  &lt;SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /&gt;
                  &lt;HeaderStyle CssClass="clsListHeading" Font-Size="Small" /&gt;
              &lt;/asp:GridView&gt;&lt;/div&gt;
  
          &lt;asp:GridView 
              AllowSorting="True"
              ID="grdProduct"  
              runat="server" BackColor="White" BorderColor="White" 
              BorderWidth="3px" CellPadding="2" Width="98%" AutoGenerateColumns="False" 
              HorizontalAlign="Center" Font-Names="Arial" 
              style="margin-top: 0px" HeaderStyle-ForeColor="White" &gt;
              &lt;RowStyle ForeColor="Black" /&gt;
              &lt;Columns&gt;
  
                  &lt;asp:BoundField DataField="Partner" HeaderText="Partner"
                      SortExpression="Partner"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
                  &lt;asp:BoundField DataField="ProductDesc" HeaderText="Product"
                      SortExpression ="ProductDesc"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
                  &lt;asp:BoundField DataField="DateTaken" HeaderText="Date Taken" 
                      SortExpression="DateTaken" DataFormatString="{0:d}"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
                  &lt;asp:BoundField DataField="DateExpired" HeaderText="Date Expired" 
                      SortExpression="DateExpired" DataFormatString="{0:d}"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
                  &lt;asp:BoundField DataField="CourseDesc" HeaderText="Course"
                      SortExpression="CourseDesc"&gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
                  &lt;asp:BoundField DataField="Status" HeaderText="Status" 
                      SortExpression="Status" &gt;
                      &lt;ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Size="Small" /&gt;
                  &lt;/asp:BoundField&gt;
  
              &lt;/Columns&gt;
              &lt;FooterStyle BackColor="White" ForeColor="#000066" /&gt;
              &lt;PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /&gt;
              &lt;SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /&gt;
              &lt;HeaderStyle CssClass="clsListHeading" Font-Size="Small" /&gt;
          &lt;/asp:GridView&gt;
           &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>