求高手指点
时间:2011-12-22
来源:互联网
.NET MVC3写的,运行的时候出这个错误
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[MessageBD.Models.LogInfo]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[MessageBD.Models.MessageBoard]'.
估计是路由问题
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "MessageBoardIndex", id = UrlParameter.Optional } // Parameter defaults
);
}
我在URL里输入“http://localhost:111/messageboard”
结果出现上述错误
求高人指点,如何改
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[MessageBD.Models.LogInfo]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[MessageBD.Models.MessageBoard]'.
估计是路由问题
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "MessageBoardIndex", id = UrlParameter.Optional } // Parameter defaults
);
}
我在URL里输入“http://localhost:111/messageboard”
结果出现上述错误
求高人指点,如何改
作者: jl2xs 发布时间: 2011-12-22
很显然,页面接收的Model类型,与控制器返回的类型不匹配
作者: Return_false 发布时间: 2011-12-22
俺是新人,嘿嘿
作者: jl2xs 发布时间: 2011-12-22
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28