Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3846106
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:20:48+00:00 2026-05-19T16:20:48+00:00

Everything works fine out of the box, but after adding a new controller that

  • 0

Everything works fine out of the box, but after adding a new controller that returns a strongly typed view using the model ‘MySite.Models.Cars’, i get the an error when calling Html.Partial(“LogOnPartial”) in SiteLayout.cshtml. I call the new view like this:

return View(db.Cars.FirstOrDefault());

This is the error:

The model item passed into the
dictionary is of type
‘MySite.Models.Cars’, but this
dictionary requires a model item of
type ‘MySite.Models.LogOnModel’.

Very frustrating. When i use the new view without supplying a model it works again.

return View();

I setup the exact same conditions in MVC 2/ASPX and it worked just fine. I am not sure whether this is an MVC 2/MVC 3 or ASPX/Razor issue. In fact it might be a late night issue…

Very thankful for any reply.

EDIT:

First line from LogOnPartial.cshtml (i removed the underscore)

@model MySite.Models.LogOnModel

First line from Index.cshtml (new view):

@model MySite.Models.Cars
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T16:20:49+00:00Added an answer on May 19, 2026 at 4:20 pm

    By default the _LogOnModel.cshtml partial as created by the template is not strongly typed and doesn’t require any model. If you modified it so that it requires a model you will need to pass this model when calling it:

    @Html.Partial("_LogOnPartial", SomeLogonModelInstance)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I implemented this Jquery show/hide code and everything works fine except that the box
Everything works fine, the only problem is that it loads very slow. It takes
I have my pickerview set up and everything works fine, but right now I
I'm getting a 404 on my server (IIS 7) but everything works fine on
Using the C# Facebook SDK 5.0.3 everything works fine whit the client.Get(/me). But when
I'm following this tutorial on WCF and everything works fine. Seems like with that
Everything works fine on my OS X development laptop. Deploy the app to production
Everything works fine locally when I do as follows: cat input | python mapper.py
I'm building a project using a GNU tool chain and everything works fine until
I am using hibernate annotations and when I do following everything works fine sessionFactory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.