I have an application written is C# ASP.NET MVC 4 with Razor views.

I am a bit stuck on my menu structure.

enter image description here

As per the image above, one can see that there is a Top Menu and a Side Menu.

The standard menu bar that we all know has the logic that each Menu Item has sub items.

What I need is for the Top Menu to contain the Menu Items, then the sub items relevant to those items, to appear in the Side Menu.

The Green and the Yellow sections in the image above is part of my _Layout.cshtml page. The White section is where the RenderBody() happens.

As one would select the items in the Side Menu, the White section will get updated.

So my thinking was to have a RenderSection in the _Layout.cshtml that will render based on the view used. But my gut tells me there is a better approach.

Is it perhaps better to define those Sub Menu Items in the layout page as static, and just keep adding to it as new features come along? Or what is a better approach to load those elements dynamically?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.