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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T10:59:01+00:00 2026-05-28T10:59:01+00:00

This is all hypothetical, and wondering how and if this is possible. I have

  • 0

This is all hypothetical, and wondering how and if this is possible.

I have two different strongly-typed views that use two different models. For example, I have a View1.cshtml, and View2.cshtml. Each has it’s own model: View1Model.cs and View2Model.cs. Each of the view pages uses a common layout (_Layout.cshtml) that has a PartialView (_WhoAmI.cshtml).

In the View1Model.cs there is a UserID field (with various other fields) and the View2Model.cs also contains the same UserID (with different fields than View1Model.cs).

The partial view will lookup the UserID and display the User’s information in a small display .DIV.

What is the best way to do this and keep the PartialView strongly-typed? Is it even possible when both models of the view are so different (other than the UserID)? If so, if I use this PartialView again in the _Layout, how do I keep it from doing the User lookup two times in the Layout page for each time the partial is called?

Thanks in advance!

  • 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-28T10:59:02+00:00Added an answer on May 28, 2026 at 10:59 am

    Instead of Html.Partial you could use Html.Action and have a child action rendering the partial and doing the necessary lookups.

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

Sidebar

Related Questions

In this hypothetical example, imagine I have an object FooSet that has five properties
This is a hypothetical for simplicity. In my Django app I have models for
Let's say I have a hypothetical controller called ThingsController that exposes two actions: index
I see this all the time: object literals declared such that some keys are
I have been struggling with this all day. I have an html table in
I have a feeling I'm going about this all wrong. But anyway. I have
This hypothetical example illustrates several problems I can't seem to get past, even though
(This was meant to be a general hypothetical question, me whining that .NET was
I have this hypothetical table: +----+---------+-------+ | id | type_id | value | +----+---------+-------+
I'm just wondering, as a hypothetical example, what would be the best way to

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.