I am having following problem:
Defined RegisterModel class - with some validation rules for creating new users, and this works fine.
Then I get this class, strip few properties and wanted to reuse it as UserInfo_Form_Model, for editing user properites.
No changes, just deleted few items, renamed and reused in strongly typed View for editing.
And result of validation is: -
[DisplayName("Name")] works fine, showing correct
[StringLength(20, ErrorMessage = "xxxx...")] - not working, no message showed when suppose to be one
[Required(ErrorMessage = "xxxx.")] - not working, not showing messages when delete required values?
but (ModelState.IsValid) is false when I checked it in controller (it had to be because required value is missing)?
Is it this only partially correct and how this can be?
Well this is a bit frustrating because it cant be simpler than this and I cant make this simple code reuse. :|
Quite a few gotchas I already found or I am coding completely wrong.
View Complete Post