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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:30:53+00:00 2026-06-14T07:30:53+00:00

In my master view (_Layout.cshtml) I have a tree-menu. I want to remove that

  • 0

In my master view (_Layout.cshtml) I have a tree-menu.

I want to remove that tree-menu in the main page (home).
The rest of the layout should stay there, I want the body of the home to occupy the space of the tree-menu.

Any efficient in-the-box option?

  • 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-14T07:30:54+00:00Added an answer on June 14, 2026 at 7:30 am

    One approach could be to create a custom view page with a flag for showing/excluding the tree menu.

    public class CustomViewPage<T> : WebViewPage 
    {
        public bool ShowTreeMenu 
        { 
            get 
            {
                return (ViewBag.ExcludeMenu == null || ViewBag.ExcludeMenu == false);
            }         
        }
    }
    

    Inherit the custom class from within the layout file:

    @inherits CustomViewPage<dynamic>
    

    Then (In the layout file) only display the tree menu if:

    <nav>
    @if (ShowTreeMenu)
    { 
        @Html.Partial("_TreeMenu")                            
    }
    </nav>
    

    And set the flag from the content page when the menu should be excluded:

    @{
      ViewBag.Title = "Home Page";
      ViewBag.ExcludeMenu = true;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view and I want to use a layout page. In the
I have an app that main layout is a custom top bar (with actions
I have something like @{ Html.RenderPartial(@~/Views/Management/_Main.cshtml); } Can I change this view without page
Possible Duplicate: Rendering views without master page in MVC3 I have one view in
I have a razor master layout _Master.cshtml and I include Master.css in it. I
if i need remove master layout from my view, how can i do it
I have one (razor) page that contain 5 different partial views. Each partial view
Background: I have an MVC layout (master) view which uses @Html.RenderAction to display a
I have asp.net mvc application, that uses razor view engine. I want to send
I have a view where I'm using a specific layout.cshtml file, other than the

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.