title: GridView.DataSource is null during PostBack
body: <p>i want to implement a print / download csv from each Gridview in my application. Those get their data by Datasources or directly by </p>
  
  <pre><code>gvSample.DataSource = Data;
  gvSample.DataBind();
  </code></pre>
  
  <p>Now my first approach was setting a Download-Button into the Footer-Template and handle the Download there</p>
  
  <pre><code>&lt;asp:GridView ID="gvSample" runat="server"&gt;
   &lt;PagerTemplate&gt;
    &lt;asp:ImageButton  ImageUrl="~/download.gif"  OnClick="dl_Click" runat="server" ID="dl"/&gt;
   &lt;/PagerTemplate&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>protected void dl_Click(object sender, ImageClickEventArgs e)
  {
      GridView gv = (GridView)this.Parent.Parent.Parent.Parent;
      string csv = ToCSV(gv.DataSource); //gv.DataSource is null, DatasourceID aswell
      Response.ContentType = "application/csv";
      Response.AddHeader("content-disposition", "attachment; filename=file.csv");
      Response.Write(csv);
      Response.End();           
  }
  </code></pre>
  
  <p>but i cant access the data.</p>