Hey everyone,
I'm trying to call an ActionResult from my View so that I can export data to excel using EPPlus. So far I've been able to get a list of all records in the database to display on the page.
Next I want to use a button to call the ExportToExcel function inside my surfacecontroller, but I get this error:
OutputStream is not available when a custom TextWriter is used.
How to call ActionResult method from View
Hey everyone, I'm trying to call an ActionResult from my View so that I can export data to excel using EPPlus. So far I've been able to get a list of all records in the database to display on the page.
Next I want to use a button to call the ExportToExcel function inside my surfacecontroller, but I get this error:
Here is how I'm trying to call the function:
Here is my surfacecontroller function:
Now the error is being thrown as soon as the page loads.
Can anyone tell me what I'm doing wrong?
Resloved:
I changed this:
to this:
and everything works as expected now.
is working on a reply...