开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜