consider classic example: Product
in dropdown Id of Category is
selected - Category mapped
as object with all fields empty
when submitting Product edit form -
validation gives an error: "Category
name is required" (I have Required
attribute on Category Name property)
How deal with such errors if I want to use built-in validation (if (!ModelState.IsValid))?
Writing custom data binder which would fill all such id-only-objects with values from database comes to mind.upd: I did small research of mvc code and found out that validation happens before binding - so this solution would't work.
Do you have any other solutions for this problem?
View Complete Post