Reputation: 67
I'm using razor view to display the info and the info display perfectly but when I press the action link to download the file the action comes null from the view.
View:
@model Innovation_Internship.Models.Applicant
@Html.ActionLink("Download", "Download", "Admin", new { filename = Model.Resume })
Controller:
public ActionResult Download(string filename) <-- comes null
{
try
{
}
catch (Exception)
{
//download failed
//handle exception
throw;
}
}
Upvotes: 0
Views: 45
Reputation: 149
Model.Resume seems to be an object rather than as string. Maybe the object or refrence is null. - maybe use .ToString()
Also add null to the end or you may call the wrong version of the function
@Html.ActionLink("Text","Action","Controller", new { item.ID }, null)
There is also another SO post related: HTML.ActionLink method
Upvotes: 1