Reputation: 9963
I am creating my first mvc3 application (no previous mvc either) I am wanting to create a top level menu and be able to add a "selected" or "active" css class to the select LI tag. I found this link active menu item - asp.net mvc3 master page Ihave tried to add it to a class however I get an error back "Error 1 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'ActionLink' and no extension method 'ActionLink' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?) G:\MvcMusicStore-v2.0\MvcMusicStore-Completed\MvcMusicStore\Helpers\HtmlHelpers.cs 26 31 MvcMusicStore "
So I am thinking I am missing a reference to something however I don't know what. Can someone kindly tell me what I need to reference to get this to work.
Upvotes: 3
Views: 5749
Reputation: 1038710
Add the following using at the top of your HtmlHelpers.cs
file:
using System.Web.Mvc.Html;
Now the htmlHelper.ActionLink
line should compile just fine.
Upvotes: 4