jeudi 23 juillet 2015

MVC Null Reference on Model

I'm trying to implement a partial view but I'm having troubles with the model. I'm getting the following error:

System.NullReferenceException: object reference not set to an instance of an object

The HTML code where the error is detected is the following:

@model IEnumerable<BUGTRACKER.Models.Revisiones>


<table class="table">
<tr>
    <th>
        @Html.DisplayNameFor(model => model.Version)
    </th>
    <th>
        @Html.DisplayNameFor(model => model.Descripción)
    </th>
    <th>
        @Html.DisplayNameFor(model => model.Fecha)
    </th>
    <th></th>
</tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Version)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Descripción)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Fecha)
        </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>
}

I really don't know what's going on here, any idea?

Aucun commentaire:

Enregistrer un commentaire