I have an object that was previously round-tripping from the server to the client and back nicely (i.e. edit and view forms worked fine). However, I've added to that object a complex type and made a custom ModelBinder to handle it. The complex type can be represented as a single string but is stored in the object as a Decimal (think "0 ft. 3in." can be stored as 0.25).
My problem, however, is when validation fails. If a user types "asdf", validation fails. But what gets stored in the Decimal is just 0. So when the view is rendered and sent to the user, they just see "0" and an error message, rather than seeing "asdf". I don't have this problem with the default ModelBinder (other fields round-trip the invalid string just fine), so I must be missing something in my custom ModelBinder... but what is it?
I've tried calling
bindingContext.ModelState.SetModelValue(bindingContext.ModelName, New ValueProviderResult(null, attemptedValue, Globalization.CultureInfo.CurrentCulture))
But it doesn't seem to affect anything.