-7

I have a table of menu and use partial view to show it but my problem is that how to show this menu in all pages of website or how to show the partial view content in layout page.thnx

tereško
  • 56,151
  • 24
  • 92
  • 147
  • Use `@Html.Partial()` or `@Html.Action()` –  Sep 24 '15 at 10:08
  • but i have to pass model data in which list of menu item comes dynamically. – user5352917 Sep 24 '15 at 10:14
  • Then use `@Html.Partial()` or `@Html.Action()` (but I seem to remember saying that before). Do some research. The question will be closed shortly –  Sep 24 '15 at 10:16

1 Answers1

0

In your _PublicLayout.cshtml file, (this is the file every other page uses in your project. The file has a @RenderBody() section, so every view you make, will appear there.

But if you want to make a partial view and it needs to be displayed on all pages of your project, you can place that in the _PublicLayout file.

So for your navigation, make the partial view, and add it like this in your _layout.cshtml file: <div id="nav">@Html.Partial("_NameOfTheFile")</div> <div id="body"></div> <div id="footer"></div>

Dylan Slabbinck
  • 836
  • 1
  • 15
  • 27