title: Export sqldatasource to excel not just list or gridview
body: <p>I'm trying to export my listview, but not just the visible listview, I want to export the entire contents of the sqldatasource.  The query returns 20 columns, only a small set (5) are displayed on the listview.  Is there a way i can export the entire 20 columns to excel file? </p>
  
  <p>I have this so far:</p>
  
  <pre><code>protected void ExportToExcel(object sender, EventArgs e)
  {
      Response.Clear();
      Response.Buffer = true;
      Response.ContentType = "application/vnd.ms-excel";
      Response.AddHeader("content-disposition", "attachment;filename=SearchResults.xls");
      Response.Charset = "";
      Response.Cache.SetCacheability(HttpCacheability.NoCache);
      this.EnableViewState = false;
      StringWriter stringWriter = new StringWriter();
      HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
  
      //I want to chagne this:
      this.ResultsListView.RenderControl(htmlTextWriter);
  
      Response.Write(stringWriter.ToString());
      Response.End();
   }
  </code></pre>
  
  <p>instead of this line:</p>
  
  <pre><code>    this.ResultsListView.RenderControl(htmlTextWriter);
  </code></pre>
  
  <p>I would like to do something like:</p>
  
  <pre><code>    this.sqldatasource.RenderControl(htmlTextWriter);
  </code></pre>
  
  <p>But obviously SqlDataSource doesn't have a RenderControl method.  Is there a clean way of going about this? </p>