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 4099988
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:30:29+00:00 2026-05-20T20:30:29+00:00

I have a layout which it has two partial views, one for LogIn and

  • 0

I have a layout which it has two partial views, one for LogIn and one for Register.

//Login (In layout)
@Html.Partial("_LoginPartial")
and in the partial
@model LogOnVM

///register (in layout)
@Html.Partial("_RegisterPartial")
and in the partial
@model RegisterVM

As it shown, both of them have different Models.

My problem is that when I am trying to add one more view(with different model) that is derived from this layout I am getting the following error

The model item passed into the
dictionary is of type ‘HomeVM’, but
this dictionary requires a model item
of type ‘LogOnVM’.

How could I render the partials in the layout without having any problem with the other views?

Thanks

  • 1 1 Answer
  • 1 View
  • 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-20T20:30:30+00:00Added an answer on May 20, 2026 at 8:30 pm

    Well, I found a solution.

    Instead of calling the partials with RenderPartial, I have created two ActionResult methods in Account Controller:

    1. One for LogIn (LoginPartial)
    2. One for register (RegisterPartial).

    Then in layout I call them with RenderAction():

    Html.RenderAction("LoginPartial", "Account");
    Html.RenderAction("RegisterPartial", "Account");
    

    I don’t know if it is the best approach for performance but it works fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a XML layout which has two edit text fields, one for title
I have created following layout.which has two relative layouts and one scrollview ,following code
I have an activity that has two layouts one in the folder layout and
I have in my layout a button, which is has to change image when
I have an alternate homepage template, homepage.pt, which has a different layout. When I
I have a quite complicated HTML/CSS layout which I would like to convert to
I have two build definitions for my project which has two branches. Development and
I have a program (time lapse maker) which has two threads that updates a
I need to have a single <li> element which has two buttons inside of
Basically, I got one activity has two layouts, one is gridview, which has mBaseAdapter

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.