espero me puedan ayudar soy novata, estoy realizando una aplicación web con ASP.net MVC pero no puedo encontrar el error que origina esta excepción, este es mi código.
Les explico un poco, estoy tratando de mostrar una lista de una pantalla parcial.
Mi vista principal
@model Entity.CovidCE
@{
ViewBag.Title = "Registro";
Layout = "~/Views/Shared/_Pmedico.cshtml";
}
<div class="col-md-6">
@Html.Partial("GetPruebaCovid")
</div>
Mi vista parcial (que contiene la lista)
@model IEnumerable<Entity.covid>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.covid_id)
</th>
<th>
@Html.DisplayNameFor(model => model.covid_paci_id)
</th>
<th>
@Html.DisplayNameFor(model => model.covid_fecha)
</th>
<th>
@Html.DisplayNameFor(model => model.covid_tipo)
</th>
<th>
@Html.DisplayNameFor(model => model.covid_resultado)
</th>
<th>
@Html.DisplayNameFor(model => model.covid_condicion)
</th>
<th>
@Html.DisplayNameFor(model => model.covid_frecuencia)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.covid_id)
</td>
<td>
@Html.DisplayFor(modelItem => item.covid_paci_id)
</td>
<td>
@Html.DisplayFor(modelItem => item.covid_fecha)
</td>
<td>
@Html.DisplayFor(modelItem => item.covid_tipo)
</td>
<td>
@Html.DisplayFor(modelItem => item.covid_resultado)
</td>
<td>
@Html.DisplayFor(modelItem => item.covid_condicion)
</td>
<td>
@Html.DisplayFor(modelItem => item.covid_frecuencia)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>
</tr>
}
</table>
He estado investigando, y lo que encuentro es que esta tratando de acceder a un objeto nulo. Mi duda es que cuando ejecuto la vista parcial si me muestra la lista sin ningún error, y cuando llamo la vista parcial desde mi vista principal me lanza esta excepción.
Les agradecería si me pudieras ayudar.
object
en@Html.Partial
. – Hernán Alarcón el 9 dic. 20 a las 2:37