views:

54

answers:

1

For number of years I did ASP.NET web forms development I was spoiled by a proprietary library, which allowed me to do things like:

    UpdateToObject(ControlsCollection, obj)
    UpdateFromObject(ControlsCollection, obj)

Conceptually code did something very similar to what MVC Model Binder does, i.e. given form's posted values as input it would populate custom object. Basically it freed developer from doing monkey code such as

employee.Name = txtName.Text;
employee.DOB = DateTime.Parse(txtDOB.Text);

and so on..

Now, this proprietary library is not available on the new project I'm involved with, and it's a Web forms project. So I'm wondering if there is a way of using System.Web.Mvc.DefaultModelBinder in the context of Web forms. Goal is to achieve simple and easy population of controls from domain objects and back, ideally with validation annotations taken into consideration. If such is not possible could somebody point me to an open source solution to address this need. I really don't feel like rewriting such code.

Thanks in advance.