Controller action method-

public ActionResult Index()
{
    var todaysTarget = from ra in db.Employee ...
                       select new { ra.RaCode, ra.TargetQuantity };
    return View(todaysTarget.ToList());
}

Razor view-

@model List<object>


@foreach (var item in Model)
{
    @:item.Name;
}

It gives me exception-

this dictionary requires a model item of type 'System.Collections.Generic.List`1[System.Object]'.

Any help?

Related posts

Recent Viewed