Write content from ASP.NET to Excel
The following program shows how to write the GridView content to an Excel file and save to a desired location.
Here we are using the FileStream class to write the content to a local system.
The following method will confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.
Somtimes you will get an exception unless you are not declared the above method in your program the exception shows like :
Click the following links to see full source code