I’m making the transition to MVC 3 and was attempting to create a friendly Menu Interface after the person logs onto the site. I stumbled across this article which suits what I need:
http://forums.asp.net/t/1583036.aspx/1
The third code sample is marvelous example of how I can dynamically build a menu interface. It contains the menu and the sub menu. The article creates a controller and a menu model, but I’ve struggled to get it implemented into Razor – has anyone successfully tried this route in a similar fashion?
Simply replace
<%=with@:In order to bring the MenuItem custom helper into scope for your Razor views make sure to reference it’s namespace inside the
<namespaces>tag of~/Views/web.config(and not~/web.config):