Saturday, February 19, 2011

ASP.NET MVC: Controller ViewData & ViewPage ViewData

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.

From stackoverflow
  • 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.

0 comments:

Post a Comment