Skip to main content
1 of 2
roverred
  • 397
  • 1
  • 3
  • 8

MVC: Inserting a view from a SubController to it's Parent controller

I have 2 controllers: 1 top level controller,MainController, and a SubController, which MainController has an instance of and controls. The SubController has a Subview which goes inside the MainView as some sub web element.

What is a good way to insert the SubView into MainView? I can think of:

  1. I can give SubController and SubView a reference of the MainView and append to it in the Subview

  2. Return the html from the SubView rendering function to SubController, which returns to it to the MainController -> MainView -> render

Or is there a much better way?

roverred
  • 397
  • 1
  • 3
  • 8