Partners of Stack Overflow in Spanish, I have the following error when doing this conditional ViewBag.p.Where(n => n.Lider == namelider
in cycle foreach
.
Here I show you part of my code:
<table class="table table-bordered">
@foreach (var item in ViewBag.c)
{
var namelider = item.lider;
<tr>
<td>@item.nombres</td>
<td>@item.lider</td>
<td>@item.eje_funcional</td>
@foreach(var peso in ViewBag.p.Where(n => n.Lider == namelider))
{
<td>@peso.Lider</td>
}
</tr>
}
</table>
The error that appears to me is the following:
You can not use a lambda expression as an argument for a operation sent dynamically without first converting it into a delegated type or of expression tree.
I add driver queries:
ViewBag.c = (from p in db.Collaborators
where p.grupo_lider == "NO"
select p).ToList();
ViewBag.p = (from p in db.Objectives
select p).ToList();
ViewBag.cal = (from p in db.CalificarColaboradors
select p).ToList();