传递到字典的模型项的类型是“Sitecore.Mvc。presentation.RenderingModel',但这个字典需要类型的'X'的典范项目 [英] The model item passed into the dictionary is of type 'Sitecore.Mvc.Presentation.RenderingModel', but this dictionary requires a model item of type 'X'

查看:213
本文介绍了传递到字典的模型项的类型是“Sitecore.Mvc。presentation.RenderingModel',但这个字典需要类型的'X'的典范项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建设有Sitecore的7和ASP.NET-MVC 3的解决方案,并试图使用自定义模型类在<一个描述href=\"http://www.sitecore.net/france/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2012/06/Sample-Base-Class-for-MVC-View-Models-in-the-Sitecore-ASPNET-CMS.aspx\"相对=nofollow>这篇博客文章由约翰·西。

I am building a solution with Sitecore 7 and ASP.NET-MVC 3 and trying to use a custom model class as described in this blog post by john west.

我在这里看到的其他一些问题上的SO报告与ASP.NET MVC的(无Sitecore的)类似的错误,通常与传递错误的对象类型的控制器code,或者是有一个配置错误在 \\浏览\\ web.config中文件,但似乎都不是这里的问题。

I have seen several other questions here on SO reporting a similar error with ASP.NET-MVC (without Sitecore), usually related to passing the wrong type of object in controller code, or there being a configuration error with the \Views\web.config file, but neither seem to be the issue here.

推荐答案

在控制器渲染调用该方法返回一个的ActionResult 的对象,而不是一个控制器的方法,可以导致此错误一个 PartialViewResult 。在我来说,我有我相信Sitecore的是想传递给我的控制器渲染的布局相关的渲染模式。

This error can be caused when a controller rendering invokes a controller method which returns an ActionResult object instead of a PartialViewResult. In my case I had a rendering model associated with the layout which I believe Sitecore was trying to pass to my controller rendering.

这篇关于传递到字典的模型项的类型是“Sitecore.Mvc。presentation.RenderingModel',但这个字典需要类型的'X'的典范项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆