Well, I'm developing an application that manages Courses , and I have the following problem. On my Administrator screen I need the Course Name , Student Name fields and the Approved field that is a booleano
field. This screen is where the Administrator says which student is approved in the course they enrolled in. However, only the Course Name fields and the Approved and no fields appear in my View
/ strong>, as shown below.
TheotherproblemisthatthisApprovedfieldwhenIsetcheckbox
isnotsavingastrue
inDatabase,isalwaysgettingfalse
.
ActionApprovedofcontroller
Course
publicActionResultAprovacao(){returnView(db.Cursos.ToList());}
MyViewAprovacao
@model IEnumerable<MeuProjeto.Models.Curso>
@{
Layout = "/Views/Shared/_Layout.cshtml";
}
<h2>Aprovação</h2>
<table class="table table-hover">
<tr>
<th>
Curso
</th>
<th>
Aluno
</th>
<th>
Aprovado?
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Nome_Curso)
</td>
<td>
@Html.DisplayFor(modelItem => item.AlunoCursos)
</td>
<td>
@*@Html.DisplayFor(modelItem => item.Aprovado)*@
<input type="checkbox" id="Aprovado" name="Aprovado" value="Aprovado"/>
</td>
</tr>
}
</table>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}