In partial view: "The model item passed into the dictionary is of type"

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2012-06-19T13:41:24Z Indexed on 2012/06/19 15:16 UTC
Read the original article Hit count: 245

Filed under:

I lack understanding of some basic MVC concepts, despite all my searching.

I created an MVC project in Visual Studio, which contains the partial view _LogOnPartial.shtml. I just want to access information within the view pertaining to the user, to put in a user dropdown menu. When I try to put this at the top of the partial view cshtml page I get the above error:

@model MyProject_MVC.Models.UserRepository

When I try this I also get an error:

@Html.Partial("_LogOnPartial", MyProject_MVC.Models.UserRepository)

'MyProject_MVC.Models.UserRepository' is a 'type', which is not valid in the given context

© Stack Overflow or respective owner

Related posts about asp.net-mvc-3