0

I have a navigation on my _Layout.cshtml. How can i hide it for some views/urls? Do not want to use javascript for this problem.

MR.ABC
  • 4,712
  • 13
  • 44
  • 88

1 Answers1

3
  • Create a different Layout file based on your _Layout.chtml
  • Remove the URLS you don't want.
  • Update your views to use this layout.

Alternatively you can use a model for your layout page but from my experience it isn't worth the hassle.

Update - Example Using A Model in Layout

You essentially use a base model which is used for your layout and your view models inherit from it. Here's a link to another SO question with example code.

Community
  • 1
  • 1
heymega
  • 9,215
  • 8
  • 42
  • 61
  • A model for the layout page? Sounds interesting as well. Any example. I know how i create a model for the views. – MR.ABC Jan 12 '15 at 10:07