Search code examples
asp.net-mvc-2defaultmodelbinder

default model binder


Basically i have a form with around 100 elements. The values bind to my model when i submit the form. But i want to work on certain values of the form elements before the values are set. Basically i want the 95 values of elements of the form be set by the default binder but i want to work on the values of five elements before it is set.

Any suggestions as to how to go about doing it by overriding the default model binder ?


Solution

  • I could achieve the same by overriding the BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, System.ComponentModel.PropertyDescriptor propertyDescriptor) function in the DefaultBinder