Last post Jan 07, 2008 01:17 AM by robconery
Jan 03, 2008 06:32 PM|uooq|LINK
I'm sorry if this is a really silly question, [:$] but I'm having a hard time grokking what the right usage of a ViewUserControl looks like. Does one invoke the RenderView from a controller? If so, where is the parent page that the ViewUserControl is embedded
in? Or, should you put RenderView into the ASPX of a ViewPage itself?
I can make the thing render in any number of different ways from different places, but I'm not clear on what the right MVC model is for this situation. I've read the long thread on the ".. very complex page with many MVC modules..." but I'm thinking of
a simpler scenario: Let's suppose you have three or four different views that you want to compose into a page? Is this the right scenario for a ViewUserControl? If so, where would you reference the control itself?
Also, are there any working examples posted that use ViewUserControls?
Now repeat the above question but swap in Master Page/ViewContentPage :)
Jan 03, 2008 07:23 PM|tgmdbm|LINK
Ok, the Controller should contain no logic other than where to get the data from, which view to render, and how to pass the data to the view.
The view is solely responsible for rendering the view, and so by extension, responsible for displaying any "sub views". So any ViewUserControls belong here.
However, a lot of the time the UI is customisable, ie, this user was the weather control, and this user has the stock control. And the information regarding which user has which controls is stored in the database and so the controller is now concerned about
something other than the entities being acted upon.
To be perfectly honest i don't know the best way to organise this. It would be good if someone could write a good blog post on this.
Jan 07, 2008 01:17 AM|robconery|LINK
Did you say "good long blog post"... oh dear. You're egging me on aren't you :).
And here I was thinking that I might get some sleep tonite :)