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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:15:00+00:00 2026-06-12T23:15:00+00:00

I have created a base viewmodel that all of my view models inherit from.

  • 0

I have created a base viewmodel that all of my view models inherit from. That part is easy.

All views are bound to a viewmodel (all are inherited from the base view model)

Within the OnActionExecuted method I insert a true/false value onto a property within the baseviewmodel depending on some conditions.

From the view side of things. I have a single layout page that some how I want to be able to read the property’s value and render a different partial view based on the value.

Is this possible? I dont want to have to add the code to each of the views but I don’t think I should be binding the layout to my baseviewmodel either.

If I can stay away from inserting the value into the valuebag that would be great as I need to be able to access these values anywhere in the application via strongly typed names.

  • 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-12T23:15:02+00:00Added an answer on June 12, 2026 at 11:15 pm

    what you want probably isnt possible because as you call a view from the controller then first the code inside that view is executed and then the layouts code is executed
    to achieve what you are doing you can do 2 things

    1. make the logic inside the controller itself and then render the correct view
    2.call the layout from the controller giving it the name of the partial view in some property of the model or in the viewbag

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

Sidebar

Related Questions

I have created a Base-Controller from which all the controllers inherit. Currently this controller
I have a strongly typed View class that all my UserControls derive from. It
I have created a base controller that each of my controllers inherit. In this
I have created a data base that comes in an installer that runs as
I have created a gem that adds a new method to the class ActiveRecord::Base.
I have created base ClearCase view named codecountview , it was created by cleartool
I have a view AttributeView that contains all sorts of attributes. There's also a
I have an abstract generic view-model that I use as a base-class for several
Assume I have several Views in my WPF application that all show a report,
I have created an app targeted for ios 4.1 with base SDK ios 5.0

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.