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

  • Home
  • SEARCH
  • 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 7947445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:26:03+00:00 2026-06-04T01:26:03+00:00

I have a layout with an extension method that takes a list of menu

  • 0

I have a layout with an extension method that takes a list of menu items and creates HTML from that. In the controller actions I have:

public ActionResult Article(string rk)
        {
            Viewbag.menuItems = _menu.MenuItems("00");
            ..
            return View(vm);
        }

I have this repeated in many actions. Then in the _layout I have:

Html.NavLinks(ViewBag.menuItems)

I realize we’re supposed to give the view what’s needed but in this case would it be better if the view pulled partial details from an action? I’m asking this because I have only ONE layout that needs the data and I thought it may be better to code there rather than have the data retrieved in 20+ actions and sent to the views.

If it did a pull from the layout then would MVC cache the results of the action?

If pulling results from an action was better then how exactly could I do it?

  • 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-04T01:26:05+00:00Added an answer on June 4, 2026 at 1:26 am

    If it did a pull from the layout then would MVC cache the results of the action?

    It wouldn’t cache the results of the action no, it would go and get them on every request.

    If pulling results from an action was better then how exactly could I do it?

    Instead of “pulling them from an action”, just put them in the model that you are sending back from the controller, then you can use them in your view.

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

Sidebar

Related Questions

I have a controller method that has long been handling JSON requests by parsing
I have a layout page thusly <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <script src=@Url.Content(~/Scripts/jquery-1.7.1.min.js) type=text/javascript></script>
I have a layout that uses a scroll view. The first part of the
I have a layout that is working, but it has one very annoying problem..
I have the following HTML code with CSS: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0
I made a simple extension of CheckBoxPreference so that I could have my own
I am using the Extension Libraries Application Layout Control and need to have a
I'm writing a Chrome extension and I'm specifically concerned about the HTML layout in
I have an Android Spinner view in my layout. I would like that spinner
I have a custom view (an extension of a TextView) that I want 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.