0

So say I make a controller for a main menu 'page', would MainMenu be composed of the individual view elements like labels and buttons directly or would it reference a class such as MainMenuView which had those elements instead? Or would it just send events to an event system to communicate with the view? Or something else?

fordeka
  • 979
  • 2
  • 7
  • 22

1 Answers1

1

The buttons and labels would most likely be in the View, although labels can come from the Controller. Normally a View is just the html scaffolding, and the data that the View contains is populated from the Model by the Controller. So for a main menu, it's probably going to just be links and labels to other sections so there probably won't be a Model for it, the Controller will just return the View.

So if someone went to SomeMVCSite.com/home/index, the Index Action would be called in the Home Controller. The Home Controller would retrieve data from the database based on a Model and return the View + the data.

Garrett Fogerlie
  • 4,450
  • 3
  • 37
  • 56