Reputation: 247
The model item passed into the dictionary is of type '...', but this dictionary requires a model item of type '...'
Does anyone know how to solve this error?
My controller class:
public class MapsController : Controller
{
public ActionResult Index()
{
return View(Project.Find(68));
}
//[AutoRefresh(DurationInSeconds = 30)]
public ActionResult Map()
{
var map = DeviceLocation.FindAll();
Locations l = new Locations();
l.locations = map;
return Json(l, JsonRequestBehavior.AllowGet);
}
}
My view
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<App.Models.Project>>" %>
Upvotes: 1
Views: 185
Reputation: 171559
It sounds like the wrong type is specified in your view.
Your view should start with something like:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<...>" %>
The ...
above should actually be the same type as that passed into the view from your controller.
Upvotes: 1