ASP.NET MVC dynamic menu

0

I'm new to MVC and need to make a dynamic menu, but I do not think the solution (web forms was easier rs). I have 3 models (Menu, SubMenu1 and SubMenu2) I need to go through these objects and go mounting the html in the view, but the typed view only accepts an object and even if I do with ViewBag it does not work because I have to go through the Submenu1 with the id I have a webform that I want to add to the list, but I do not know how to do it. / p>     

asked by anonymous 03.02.2016 / 18:17

1 answer

0

I found a solution as follows:

I read my objects with foreach and I was mounting the menu html in a StringBuilder, I passed the StringBuilder to a viewbag. In the view I read the viewbag like this: @ MvcHtmlString.Create (ViewBag.Menu) and it worked!

    
04.02.2016 / 11:16