@Html.ActionLink and @Html.DisplayFor at the same time (not right, but it describes what I want to do)

前端 未结 3 1832
遇见更好的自我
遇见更好的自我 2021-02-12 09:38

I have the following table located in a view within a controller named Student (/Student/Details/1):

    @foreach (var item in Model.Enrollments)
    {
        &         


        
3条回答
  •  礼貌的吻别
    2021-02-12 10:33

    // you want to use link with the displaying a course. you can use.
    
     m.Course.Title)
    
    // second approach
    
     @Html.ActionLink(item.Course.Title, "Details", "Course", new { Id = item.Course.Id })
    

提交回复
热议问题