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
Menushould be the father ofSubMenu1andSubMenu2. I believe that maybe this is not yet the best approach, but this is on your own. If the objectMenuis the parent objetop, can pass it to theviewas the default type, and access submenus as properties of that object.– Richard Dias