title: How to write data to excel file and download it in asp.net
body: <p>i have develop an application for online store in which different store keep there catalog online. but i have to develop an functionality for download there catalog  in xls file for that i have my data in datatable which i have to write in dynamically generated xls file and download it.</p>
  
  <p>for that i have try fallowing :  </p>
  
  <pre><code>DataTable ProductDetails = sql.ExecuteSelectCommand("SELECT *  FROM Products_Details_View WHERE   Supp_Id = " + Session["SuppID"].ToString() + " and Is_Available = 1"); 
  Response.ClearContent();
  Response.AddHeader("content-disposition", "attachment;filename=Catalog.xls");
  Response.ContentType = "application/excel";
  Response.Write(ProductDetails);
  Response.End();
  </code></pre>
  
  <p><a href="http://dotprogramming.blogspot.com/2013/10/aspnet-how-to-export-gridview-data-in.html" rel="nofollow">i refer it here</a> </p>
  
  <p>but am not getting any thing </p>
  
  <p>please help to get out of it.</p>