Is there a way to pass data from a View to a Controller so that I can get the data and create a .xls file on the fly?
Any help or thoughts are greatly appreciated.
Greg
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The easiest way is to create a CSV file, which can be opened directly by Excel.
Alternatively, you can use COM Interop to generate the Excel files.
The data is passed from the view to the controller method in the usual way. If you need help getting a collection of rows from the view, have a look here.
The data is provided to the user by returning a FileResult.