views:

81

answers:

2

I have the following controller Action:

public ActionResult Details(int id)
        {
            Seguimiento seguimiento = repo.GetSeguimiento(id);

            if (seguimiento == null)
            {
                return View("NotFound");
            }
            else
            {
                return View("Details", seguimiento);
            }
        }

And in the details view:

<fieldset>
        <legend>Informacion General</legend>

        <p><span class="label-for">ID:</span> <%: Model.ID %></p>

        <p><span class="label-for">Materia:</span> <%: Model.Materia.Nombre %></p>

        <p><span class="label-for">Docente:</span> <%: Model.Materia.Docente.Nombre %></p>
    </fieldset>

    <fieldset>
        <legend>Informacion Tiempo</legend>

        <p><span class="label-for">Fecha:</span> <%: String.Format("{0:g}", Model.Dia) %></p>

        <p><span class="label-for">Hora:</span> <%: String.Format("{0:g}", Model.Hora) %></p>

        <p><span class="label-for">Evaluador:</span> <%: Model.Evaluador.Nombre %></p>
    </fieldset>

    <fieldset>
        <legend>Desarrollo</legend>

        <p><span class="label-for">Objetivo:</span> <%: Model.Desarrollo.Dominio %> | </p>

        <p><span class="label-for">Objetivo:</span> <%: Model.Desarrollo.Contenido %> | </p>

        <p><span class="label-for">Objetivo:</span> <%: Model.Desarrollo.Organizacion %> |   </p>
    </fieldset>

The first two fieldsets work; the last one doesn't.

Dominio, Contenido, Organizacion are bit type is the database, so maybe that's a factor?

+1  A: 

It is probably the case that Model.Desarrollo (or Model.Materia or Model.Evaluador) is null, not Dominio etc.

Timwi
+1  A: 

This should be pretty easy to figure out. Put a break point in the method and check if the property Desarollo is null. If so, you'll need to modify your view code to account for this (or fix the reason why it is null when it shouldn't be).

tvanfosson