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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:11:26+00:00 2026-06-11T03:11:26+00:00

I have a question for the pros and cons on how reusable partial views

  • 0

I have a question for the pros and cons on how reusable partial views should be used in a project.

In the first example, I have a layout that is used between all the views. In the layout, I have a partial view that gets called using Html.RenderAction("Index", "Header"). This header changes based on if the user is logged in or not and it renders on every view.

In the second example, I have a static layout that is used between all the views. However, in this layout there are no partial views being called. The Header partial view is being called on each view and basically does the same thing as the first example (changes based on if a user is logged in or not, etc.)

Which approach is better, is one way or another the correct way? Pros and cons of each?

  • 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-06-11T03:11:28+00:00Added an answer on June 11, 2026 at 3:11 am

    One of the main ideas behind asp.net-mvc is to not reuse code. So with this in mind, you should have your Header code in your _Layout file. This way it is not being retyped in every View, and if you needed to remove it or add route values, etc you do not have to update every View that has it.

    An example of this is the _LogOnPartial that is in a default project. In the _Layout it is called by @Html.Partial("_LogOnPartial"), and the _LogOnPartial view contains a logic statement that either displays LogOn or Register or Welcome back....

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

Sidebar

Related Questions

I have a question about pros and cons of g:render and g:include. In my
Though I've used both, I never really got the decisions or pros/cons that go
I have Question and QuestionTypes. In Question table there is a foreign key that
This is a somewhat subjective question, but I'd like to hear the pros/cons for
I have a question with singlton. Where should I declare the static member of
I am not sure that I am asking right question. But I have a
I have a question about relationships between two tables. Let's say we have a
Caveats: Let me first clarify that this is not a question about whether to
I have been asked by my manager to come up the pros and cons
My question revolves around CSS Fixed Layout vs a Float Layout that extends 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.