Selected menu item in mvc3

I am creating my first mvc3 application (without previous mvc). I want to create a top-level menu and be able to add a "selected" or "active" css class to the selected LI tag. I found this link the active menu item - asp.net mvc3 main page I tried to add it to the class, however I am returning the error "Error 1" System.Web. Mvc.HtmlHelper 'does not contain a definition for ActionLink, and an ActionLink extension method cannot be found that takes the first argument of the type "System.Web.Mvc.HtmlHelper" (do you miss the using directive or assembly reference?) G: \ MvcMusicStore-v2. 0 \ MvcMusicStore-Completed \ MvcMusicStore \ Helpers \ HtmlHelpers.cs 26 31 MvcMusicStore "

So, I think I'm missing a link to something, but I don't know what. Can someone kindly tell me what I need for the link to make this work.

+3
source share
1 answer

Add the HtmlHelpers.csfollowing to the top of your file :

using System.Web.Mvc.Html;

Now the line htmlHelper.ActionLinkshould compile just fine.

+4
source

Source: https://habr.com/ru/post/1787634/


All Articles