title: MVCContrib Grid showing headers when empty?
body: <p>The elegant <a href="http://www.jeremyskinner.co.uk/2009/03/01/mvccontrib-grid-part-5-the-action-syntax/" rel="nofollow noreferrer">Action Syntax</a> in the MVCContrib Grid gives us the <code>Empty()</code> method. However, the default behavior of <code>MvcContrib.UI.Grid.GridRenderer&lt;T&gt;.RenderHeader()</code> is to <em>hide</em> the table column headers when the grid is empty. Is there a way to show headers when data is not present that does not require a major refactoring?</p>
  
  <p>Now I have heard of <strong>hiding the headers by default</strong> and hard-coding something but this is not cool to me.</p>
  
  <p>By the way, this is what is happening under the hood (in <code>MvcContrib.UI.Grid.GridRenderer&lt;T&gt;</code>):</p>
  
  <pre><code>protected virtual bool RenderHeader()
  {
      //No items - do not render a header.
      if(! ShouldRenderHeader()) return false;
  
      RenderHeadStart();
  
      foreach(var column in VisibleColumns())
      {
          //Allow for custom header overrides.
          if(column.CustomHeaderRenderer != null)
          {
              column.CustomHeaderRenderer(new RenderingContext(Writer, Context, _engines));
          }
          else
          {
              RenderHeaderCellStart(column);
              RenderHeaderText(column);
              RenderHeaderCellEnd();
          }
      }
  
      RenderHeadEnd();
  
      return true;
  }
  
  protected virtual bool ShouldRenderHeader()
  {
      return !IsDataSourceEmpty();
  }
  
  protected bool IsDataSourceEmpty()
  {
      return DataSource == null || !DataSource.Any();
  }
  </code></pre>