Hi there!

I have a collection property of a custom class "foo" (namely an
IList<foo>) in which class I have a property "value" and another
property "Regex" which holds the allowed format of "value". To
validate this property, I added the Attribute [Valid] on the topLevel
to the collection as following:
[Valid]
public virtual IList<foo> newNameofthisCollection

Then I have the CustomFooValidator class which is checking the "value"
property against the Regex property and returns false if the property
is invalid. But to make this working, i had to define the Validator to
be a "ClassValidator" adding "AttributeUsage(AttributeTargets.Class)"
to the ValidationClass Definition.

If it comes to the validation, MVC adds an InvalidValue Object to the
ModelState Property of the Object. The Problem is now, MVC does not
know to what property of "foo", it should map the InvalidValue because
the Object in the Collection has been validated on ClassLevel.

Does anyone know a way, how to define in the ValidationClass on what
property it should map the ValidationError? Or is there an other way
to validate the collection?

Thanks a lot, just even for reading and thinking about my problem!

//stromflut
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to