开发者

Error wrong type?

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, JsonRequestBehavio开发者_StackOverflow社区r.AllowGet);
    }
}

My view

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<App.Models.Project>>" %>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜