I'm a newbie in MVC. Sorry all professionals for this question.
I have a model like:
public class Student
{
public int ID { get; set; }
public int Number{ get; set; }
public string Name{ get; set; }
public string Surname{ get; set; }
public bool IsStudentNow { get; set; }
}
In my "paged" index.cshtml
page, i call this model like this;
@model PagedList.IPagedList<WebProj.Models.Student>
It's ok for the paging or foreach statement but I can't access the model property in HTML helper.
For example;
I can't access this property;
@Html.DisplayNameFor(model=> model.Number)
@Html.DisplayNameFor(model=> model.Name)
But I can access this;
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Number)
</td>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
So, I want to access model properties in HTML helper. Don't prefer to use view model.