title: Show Pager row, but hide page numbers in Gridview
body: <p>Simple problem.</p>
  
  <p>I have an ASP.net GridView (VS2005) and it has page numbers, but when there is less than the maximum rows per page (&lt; 10), the Pager row disappears. This makes my gridview look ugly, like as if there's a missing row at the bottom.</p>
  
  <p>I can force display the Pager row, but I need to hide the page number 1, because it's obvious we're on PAGE ONE !</p>
  
  <pre><code>                &lt;asp:GridView ID="gvFTUNSENT" runat="server" 
                      AutoGenerateColumns="False" CellPadding="4" ForeColor="Black" AllowSorting="True" CssClass="gvCSS" Width="100%"
                      DataKeyNames="StudentID,StudentUnitID" DataSourceID="sdsFTUNSENT" 
                      GridLines="Vertical" AllowPaging="True" PageSize="10" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" 
                      OnPreRender="GridView_PreRender" 
                      OnLoad="GridView_Load" 
                      OnRowDataBound="GridView_RowDataBound" &gt;
                      &lt;RowStyle Wrap="True" Height="48px" /&gt;
                      &lt;Columns&gt;
  ...blahblah
                      &lt;/Columns&gt;
                      &lt;FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /&gt;
                      &lt;PagerStyle CssClass="cssPager" BackColor="#6B696B" ForeColor="White" HorizontalAlign="Left" Height="100%" /&gt;
                      &lt;HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" /&gt;
                      &lt;EmptyDataTemplate&gt;
                          &lt;asp:Label ID="lblNDF1" runat="server" Text="NO DATA FOUND" Font-Size="X-Large" Width="500px" style="text-align:center" /&gt;
                      &lt;/EmptyDataTemplate&gt;
                      &lt;EmptyDataRowStyle HorizontalAlign="Center" /&gt;
                  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Here I force show the Pager row...</p>
  
  <pre><code>protected void GridView_PreRender(object sender, EventArgs e)
  {
      GridView gv = (GridView)sender;
  
      //keep showing pager line even if there is only one row of data
      GridViewRow gvr = (GridViewRow)gv.BottomPagerRow;
      if (gvr != null)
          gvr.Visible = true;
  }
  </code></pre>
  
  <p>But I don't want to see Page 1 in there, so I tried this ...</p>
  
  <pre><code>if (e.Row.RowType == DataControlRowType.Pager)
  {
      //keep showing pager line even if there is only one row of data
      GridViewRow gvr = (GridViewRow)e.Row;
      if (gvr != null)
      {
          gvr.Visible = true;
  
          //...but hide page number if there is only one page
          if (gv.PageCount == 1)
          {
              gv.ShowFooter = true;
              gv.PagerSettings.Visible = false;
          }
      }
  }
  </code></pre>
  
  <p>But it actually hides the entire Pager row! No! I want to hide only the page numbers.</p>
  
  <p>The ShowFooter, is so it looks like the gridview is a box, closed off. But it's still ugly. I'd rather not use it if I can just keep the Pager row showing and being able to hide anything in it. ie.. keep background color intact.</p>
  
  <p>Any other ideas? Thanks</p>