I have the following ViewModel, and I would like to create a custom binder for subclass binding (LogOnModel, ChangePasswordModel).
public class LogOnViewModel
{
public string NextStep { get; set; }
public string PreviousStep { get; set; }
public string ReturnUrl { get; set; }
public bool MustChangePassword { get; set; }
public bool MustAgreeNewPrivacyStatement { get; set; }
public LogOnModel logOnModel { get; set; }
public ChangePasswordModel changePasswordModel { get; set; }
}
I managed to create my own binder (inherit from DefaultModelBinder), but was never able to return the full VALIDATED model (filled with ModelState) back to my controller. It works great for a simple type (string, bool, ....), but a bit more complicated with a complex type (subclass).
Is MVC 3 Futures the answer to my question, or was someone able to override DefaultModelbinder to bind subclasses?
Thanks Michelle
source
share