0
I am new in MVC and need to make a dynamic menu, but I do not find solution (web Forms was easier rs). I have 3 models (Menu, Submenu1 and Submenu2) I need to go through these objects and mount the html in the view, but the typed view only accepts one object and even if I do with Viewbag does not work because I have to go through Submenu1 with the Menu id and Submenu2 with Submenu1 id, with webform I went through the objects and played in a stringbuilder and then in ASPX I played the stringbuilder on a label, but with mvc I’m a little lost, someone has idea of how to do it in mvc?
From what I understand, the object
Menu
should be the father ofSubMenu1
andSubMenu2
. I believe that maybe this is not yet the best approach, but this is on your own. If the objectMenu
is the parent objetop, can pass it to theview
as the default type, and access submenus as properties of that object.– Richard Dias