title: Gridvew.RenderControl returns empty string
body: <p>I am trying to export a Gridview to excel. I bind the gridview to a collection and can see that it has 6 data rows but when i call the RenderControl it returns an empty string. Below is the code i am using </p>
  
  <pre><code>Gridview1.DataSource = data;
  Gridview1.DataBind();
  System.IO.StringWriter sw = new System.IO.StringWriter();
  System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
  Gridview1.RenderControl(htw);
  var outputHtml = sw.ToString();
  </code></pre>
  
  <p>when i check the outputHtml it is an empty string. What i am doing wrong in this piece of code. </p>
  
  <p>One thing to note is that gridview is lying inside a form with runat='server' tag and i have not overridden the VerifyRenderingInServerForm method.</p>