The code is not written by me, but has been personally tested, according to my understanding of the comments written, the wrong place everyone commented that
@{@* This is to format the current route value and save it to the Currentcontroller variable, which is formatted as controller->action, if your navigation menu points to a path that is in a cont Under Roller, it is entirely possible to dispense controller *@ var currentcontroller = string. Format ("[{0}->{1}]", viewcontext.routedata.values["Controller"]. ToString (), viewcontext.routedata.values["action"]. ToString ()); The @*helper syntax allows you to easily create reusable helper methods in a view template to encapsulate some of the functions that are responsible for outputting to the page here is a helper to construct a helper method to get the style of the navigation menu item *@ @helper MenuItem (String curcontrollername, String allowedcontrolnames) {@ (Html.raw (allowedcontrolnames.in Dexof (Curcontrollername, stringcomparison.invariantcultureignorecase)! =-1? "TT3": "))}<ul>@* Apply the MenuItem Help method to get the style of the current menu *@<Liclass= "@MenuItem (Currentcontroller,"[home->Companyintroduction] "><ahref= "@Url. Action ("Controller "," Actioin ")">Menu 1</a></Li> <Liclass= "@MenuItem (Currentcontroller,"[lottery->Trends] "TT2" ><ahref= "@Url. Action ("Controller "," Action ")">Menu 2</a></Li><binclass= "@MenuItem (Currentcontroller,"[lottery->Trends] "><ahref= "@Url. Action ("Controller "," Action ")"> Menu 3</a></Li> <binclass= "@MenuItem (Currentcontroller,"[lottery->Forecast] "TT2" ><ahref= "@Url. Action ("Controller "," Action ")"> Menu 4</a></Li> </ul>