In MVC4 how do I display the ID field from a DB. I dont want to edit the field as you cant but just display it with the other fields?
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.Genre)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>
</tr>
}
Just the same way you have done for Title and Genre
Go through this Tutorial to help you understand MVC
MVC 4 Music Tutorial