Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First of all, you need to differ between the Steve Sanderson's DataAnnotationsModelBinder and </p> <p><strong>Regarding your first question ("DataAnnotationValidationRunner doesn't walk down the complex child properties"):</strong> </p> <p>Are you perhaps referring to Brad Wilson's DataAnnotationModelBinder? If so, it really should validate complex ViewModels down to the last properties. If not, try using that instead of the DataAnnoationsModelRunner you are using. This blog article blog article on <a href="http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1" rel="nofollow noreferrer">Client-Side Validation with xVal</a> shows how. </p> <p>The first version of the DataAnnotationModelBinder had a bug that would make it crash when used with complex viewmodels. Perhaps there is a new version out which fixes the crash but ignores complex models? </p> <p>In any case, I'd suggest giving the version of the DataAnnotationModelBinder used in the demo project of the blog article linked above a try. I am using it in my own real-world project and it does work on complex viewmodels. </p> <p><strong>Regarding your second question "Is there a supported way of handling child object validation with xVal"</strong>: </p> <p>You haven't posted any code residing on ASPX forms, but you might also be referring to the fact that a &lt;%= Html.ClientSideValidation()%> only adds client-side validation to immediate properties of that Model Type, but not properties of child objects. You can simply circumvent the problem by using multiple ClientSideValidation statements, for example: </p> <pre><code>&lt;%= Html.ClientSideValidation&lt;ModelType&gt;()%&gt; &lt;%= Html.ClientSideValidation&lt;ChildModelType&gt;("ChildModelPropertyName")%&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload