Virtual Happy Hour is canceled this month (March) due to Good Friday.
Try our conversational search powered by Generative AI!
AI OnAI Off
Virtual Happy Hour is canceled this month (March) due to Good Friday.
Hi Pawan,
If this Navigation bar is on all pages, I recommend moving the Navigation bar code to its own action/controller. From there, you can call this action like this in the _Layout.cshtml file (or in any other View):
@Html.Action("GetNavigationBar", "MasterpageComponents", new { controllerType = string.Empty }) //GetNavigationBar == action name, MasterpageComponents == controller name
One thing to note - child actions can potentially hinder performance, so please be cautious in the number of child actions that are being used on each page type. Hope this helps!
-RJ
Hi,
Another solution is to use a ViewModel that contains the navigation in a property as well as the CurrentPage.
Having Partial Views with their own controllers risks leading to bad performance.
I have created one homepagetype controller and in index method i written navigation-bar code. I want that navigation-bar code in all pages so i created one partialview under homepagetype-controller and calling that in index method and in all view pages.But it's not working.Can any one help me how to solve this?