I have a large set of data that my users can filter by various options. I'd like to export this set of data as a CSV, but not sure how to send the item to my controller action.
The following code in my index.cshtml file:
@model Project.ViewModels.PeopleIndexViewModel
<a href="@Url.Action("Export", "Person", new { List = Model.People.ToList()})" title="Export to CSV">
<img src="/content/images/excel.gif" />
</a>
Turns out to be empty when I hit the controller:
public ActionResult Export(List<Person> List)
{
// List is empty here...
}
What am I doing wrong?