title: gridview databind fails if datatable has columns but no rows
body: <p>I am returning a dynamic dataset that contains multiple datatables to a dynamically generated grid view. I databind each datatable individually using the code below. </p>
  
  <pre><code>// Create the grid views for each one that was returned
          foreach (System.Data.DataTable table in datset.Tables)
          {
              WebCommon.Controls.GridView view = new WebCommon.Controls.GridView();
              ReportContainerPanel.Controls.Add(view);
              view.AutoGenerateColumns = true;
              view.ShowHeaderWhenEmpty = true;
              view.ShowHeader = true;
              view.ID = table.TableName;
              view.Size = WebCommon.Enums.TableSize.Small;
              view.DataSource = table;
              view.DataBind();
  
              // Add the spacer
              Literal spacer = new Literal();
              spacer.Text = "&lt;br/&gt;";
              ReportContainerPanel.Controls.Add(spacer);
          }
  </code></pre>
  
  <p>But i am getting this exception if the datatable being returned has columns but 0 rows. </p>
  
  <blockquote>
    <p>The data source for GridView with id 'Table4' did not have any properties or attributes from which to generate columns. Ensure that your data source has content.</p>
  </blockquote>
  
  <p>I know i can prevent this by checking for row count and then excluding that one from being printed but it is useful for the user to see that no data was returned for the grid. So i would like an empty grid with header columns to display. Is there way around this error? </p>
  
  <p>EDIT <strong>this problem seems to actually be because the empty result in question has only 1 column of type varbinary and the gridview does not like that at all.</strong> </p>