I have the following table located in a view within a controller named Student (/Student/Details/1):
@foreach (var item in Model.Enrollments)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Course.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.Grade)
</td>
</tr>
}
I would like to make each table definition into a link that takes me to a view within a controller named Course (/Course/Details/1).
I have tried things along the lines of:
@Html.ActionLink(Html.DisplayFor(modelItem => item.Course.Title, "Details", "Course"))
in place of
@Html.DisplayFor(modelItem => item.Course.Title)
Which does not compile. How would I appropriately display my model's title along with a link to the details of the referenced title?