ASP.NET MVC的RenderPartial,传递到字典的模型产品类型 [英] ASP.NET MVC renderpartial, model item passed into the dictionary is of type

查看:147
本文介绍了ASP.NET MVC的RenderPartial,传递到字典的模型产品类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这一行code麻烦: @ {Html.RenderPartial(形,Model.Contact);}
这是我得到的错误:
传递到字典的模型产品类型ContactWeb.Models.RoleListViewModel',但这需要字典类型的模型项目ContactWebLibrary.Contact。

I'm having trouble with this line of code: @{Html.RenderPartial("Form", Model.Contact);} This is the error I'm getting: The model item passed into the dictionary is of type 'ContactWeb.Models.RoleListViewModel', but this dictionary requires a model item of type 'ContactWebLibrary.Contact'.

我RoleListViewModel在视图中的最上层和我有联系物业在我RoleListViewModel所以我不知道为什么它的抱怨。任何人都可以请帮我解决这个问题?谢谢你。

I have RoleListViewModel listed at the top of the view and I have Contact property in my RoleListViewModel so I'm not sure why it's complaining. Can anyone please help me to fix this problem? Thanks.

推荐答案

作为第三个参数,你需要在一个新的ViewDataDictionary通过。

As a third parameter, you need to pass in a new ViewDataDictionary.

这篇关于ASP.NET MVC的RenderPartial,传递到字典的模型产品类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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