No, you cannot pass an entire view model like this in an action reference. You can only pass the id this model, and then retrieve the actual model using this id , no matter where you originally retrieved it:
@Ajax.ActionLink( "(Export to Excel)", "ExportCsv", "SurveyResponse", new { id = Model.Id }, new AjaxOptions { HttpMethod = "POST" } )
Alternatively, you can serialize the model as a javascript literal and then send it as JSON data with an AJAX request:
@Html.ActionLink( "(Export to Excel)", "ExportCsv", "SurveyResponse", null, new { @class = "exportCsv" } ) <script type="text/javascript"> $('.exportCsv').click(function() { var model = @Html.Raw(Json.Encode(Model)); $.ajax({ url: this.href, type: 'POST', contentType: 'application/json; charset=utf-8', data: JSON.stringify(model), success: function(result) { } }); return false; }); </script>
source share