Overriding BindModel and BindProperty in CustomModelBinder, but BindProperty never hit
I have a custom model binder with
public override object BindModel(controllerContext, bindingContext)
that checks session for an object and creates it if it isn't there, then returns the ob开发者_开发百科ject.
In that same model binder I have:
protected override void BindProperty(controllerContext, bindingContext, propertyDescriptor) , and for some reason this is NEVER hit on a postback.
BindModel() is always hit, but breakpoint on first line of BindProperty is never reached. If i comment out the BindModel() override, the BindProperty() WILL be hit. Any idea why?
are you calling base.BindModel(args)
in your overridden BindModel()
? If not, the DefaultModelBinder
won't try to bind the properties and won't call BindProperty
.
精彩评论