I am trying to convert my spark views to use ViewData.Model instead of the namevaluecollection so that I can use AutoMapper to map my dto's to entities before it gets into my action method.
I can access the viewdata.model from the view, but upon posting back the data, viewdata.model is null. here is some sample code:
in my view:
<viewdata Message="string" model="MyDto" />
${Model.Id} < -- displays MyDto.Id
In my filter on the server I am trying to do:
var model = filterContext.Controller.ViewData.Model;
but ViewData.Model is null. This is during OnActionExecuted. Is there a trick to get the ViewData.Model to grab the values from the posted view?