I am working on MVC 4 with asp .net. All is well until i get the error saying
System.InvalidOperationException: The model item passed into the dictionary is of type 'System.Data.Linq.DataQuery'1[FYPManagment.OfferedProject]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable'1[FYPManagment.Models.SupervisorModel]'.
I have search alot but still not working properly
My supervisorModel is:
public class SupervisorModel
{
public OfferedProject offerproject { get; set; }
}
My supervisorController is:
public class SupervisorController : Controller
{
DataContextDataContext dc = new DataContextDataContext();
public ActionResult ViewProject()
{
var projectdata = (from s in dc.OfferedProjects
where s.FK_sup_ID == 2
select s);
return View(projectdata);
}
}
My View is:
@using FYPManagment;
@{
List<OfferedProject> projectdata = (List<OfferedProject>)ViewData["projectdata"];
Layout = null;
}
@model IEnumerable<FYPManagment.Models.SupervisorModel>
<!DOCTYPE html>
AND
@foreach (var item in Model)
{
<tr>
<td>@item.offerproject.proj_title</td>
<td>@item.offerproject.proj_description</td>
<td><a href="#">Send Request</a></td>
</tr>
}