views:

100

answers:

2

Let's say I have a product object (pretty much empty) and I bind it to a Product view. Then I click update in the view. In my CustomModelBinder my bindingContext.Model is always null on the update request. Is there a recommended way of me retrieving the prior model at this point or do I always have to recreate it?

+1  A: 

You have to recreate it from the form fields. The values you bound to the model for the GET are long gone.

Craig Stuntz
A: 

perhaps im not understanding your needs to use a CustomModelBinder, but did u concider Data Annotations Model Binder yet?

it even comes with (serverside) validation based on simple statements like [Required] which u can put right inside your model, see this

ArjanW