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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:04:56+00:00 2026-06-01T20:04:56+00:00

Is it possible to have a master page that has a renderpartial it in

  • 0

Is it possible to have a master page that has a renderpartial it in and supply a value to be passed to that partial before it is rendered.

For example we have a common menu structure across our site, I would like to put this as a partial in the master page, the problem comes in that depending on what area in the page you are we need to set a value for the selected tab so it gets highlighted and you can see where you are.

Currently the render partial is on ever page and passes in a value for the selected tab, I would like this to be in the master page and just have some way to pass the value to the master page.

I have a feeling this might be possible with the changes introduced with razor but I’m not sure, in any case we are using asp.net mvc 2 (although I’m still interested in things that would apply to more recent versions)

  • 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-01T20:04:57+00:00Added an answer on June 1, 2026 at 8:04 pm

    You could use RouteData property to get currently called page using the following:

    ViewContext.ParentActionViewContext.RouteData.Values["controller"]
    ViewContext.ParentActionViewContext.RouteData.Values["action"]
    
    // OR
    
    ViewContext.RouteData.Values["controller"]
    ViewContext.RouteData.Values["action"]
    

    Either in the controller associated with the menu or in the view itself (if it’s partial). Then you can filter the output upon the current route.

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

Sidebar

Related Questions

So, I have a simple login page that has a light green background, and
I have a master page that uses @RenderBody to display the current controller\action content.
In my web application I have a master aspx page in that i have
I have been working on a project that has common bits of functionality, specifically
Is it possible to have multiple classes that inherit/extends same class in Google AppEngine
In SQL its possible to have fields that cannot contain duplicate data. How is
I'm trying to pass a value to Page.Title in a nested WebForms Master Page,
Is it possible to access an element on a Master page from the page
I have a question that has been viewed, but with no answers or comments
Is it possible to make one master page simply include another master page? I

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.