views:

901

answers:

1

Hello,

I seem to be unable to find the "link" between a controller's ViewData collection and a ViewPage's ViewData collection. Can anyone point me to where in the MVC framework a controlle's ViewData collection is transferred to a ViewPage's ViewData collection?

I have spent quite a lot of time using Reflector to try and work this one out but I'm obviously not looking in the right place.

+2  A: 

The Controller.View method transfers the ViewData into the ViewResult.

ViewResult.ExecuteResult transfers this into its ViewContext.

In WebFormView, the private RenderViewPage method transfers the ViewData from the context argument to the view itself. Other view in genes may work differently.

Craig Stuntz