I am using VS Express 2012 for the Web. My project is a MVC 4 project.
I am trying to make a helper to create a menu item which is a png image with a label. I pretty much cut and pasted this code:
Action Image MVC3 Razor
When I try to use the helper razor can not find it.
I get this error:
CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'AddMenuItem' and no extension method 'AddMenuItem' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
My code looks like this: http://pastebin.com/cfsN99tF
I am trying to use this from _Layout.cshtml: http://pastebin.com/5vN8yYCa
I have added the namespace to Web.Config
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="HtmlHelperExtensions" />
</namespaces>
</pages>
What else do I need to do?
you also need to reload your solution
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With