I think I know the answer, but I would like to bounce around some ideas.
I would like to pass several (in this instance 2) somewhat different pieces of data to a View. My initial thought is simply to wrap-up the various objects into a containing object and pass them along that way. Then from the View, I’d have something like
var objContainer = ViewData.Model; var thisObject = objContainer.ThisObject; var thatObject = objContainer.ThatObject;
and these could be used independently in the Master Page and View Page.
Is that the ‘best’ way?
I find it useful to create additional classes dedicated that are to be presented to the Views. I keep them in a separate namespace called ‘Core.Presentation’ to keep things organized. Here is an example:
Then I make sure that my View is a strongly typed view that uses the generic version of that presentation class:
That way in the View, I can use Intellisense and easily navigate through the items.