There are a couple of ways to make this happen. The easiest way is to postback when the download button is clicked, set all but your datagrid to invisible, and change the content type (by setting Response.ContentType) to "application/vnd.ms-excel". If installed on the client machine, Excel will then open the HTML content and translate it. To be honest, I'm not sure what the behavior is when Excel is not present on the client machine. Below are a couple of quick Code Project articles that demonstrate this method.
Creating a formatted MS-Excel sheet using ASP[^]
Export to Excel[^]
If that isn't adaquate for what you're looking to do, then you may wish to look into creating the Excel document on the server and redirecting to it. I'm by no means an expert in this area, so please take my advice with a grain of salt. Searching Code Project for "Excel" will yield several articles that offer a more informed and in-depth look at some of the below. There are various means to accomplish Excel document generation, such as using a 3rd party library, automating Excel, using an ODBC driver, or using Crystal Reports. In my opinion, you would be better off looking into a 3rd party solution, like XlsGen[^] then most of the others. Most of the others will require that all or part of Excel/MS Office be installed on the server :eek: in order to work. Hope that helps a bit. :) --Jesse