I am trying to filter through a model lets say:
public class Cat
{
public int Id {get; set;}
public int ColorId {get; set; }
}
public class Color
{
public int ColorId { get; set; }
public string? Color { get; set; }
}
in the controller :
public IActionResult GetCatsColors([DataSourceReques] DataSourceRequest request)
{
var catColor = (from c in _catContext..Cats.ToList()
join v in _colorContext.Colors.ToList() on c.ColorId equals v.ColorId
select new ColorCat
{
Colori = v.Color,
CatId = c.Id
}).ToList();
var jsonCat = catColor.ToDatasourceResult(request);
return Json(jsonCat);
}
the view:
@(Html.Kendo().Grid<TelerikOrderBossProduction.ViewModels.ColorCat>()
.Columns(col =>
{
col.Bound(t => t.Id);
col.Bound(t => t.Colori);
}
.Filterable(f => f.Mode(GridFilterMode.Row))
.etc
Now when I try to filter through the Id I get the grid to respond but when I filter by Colori I do not get a response
and I have noticed, Error 500. Server internal error.
I also have tried creating a view in the database but the same result appears. It looks like it only filters from one class but not the other.
ArgumentException: Invalid property or field - 'Colori' for type: Cat