Exclude ID property from xVal validation
Can I exclude the valudation rule f开发者_运维技巧or the ID property? Right now I get the following validationerror message when I submit the form:
- The Id field is required.
From http://xval.codeplex.com/Thread/View.aspx?ThreadId=54212
getting a ModelState.IsValid = false with a message of “ID is Required”
I think you're talking about server-side validation here. Remember that xVal's key job is enabling client-side validation, where this problem doesn't occur. On the client, you won't create a textbox for "ID" (because you wouldn't want the user to edit it directly) - at least not during the creation phase - so the client-side validator would ignore the ID property, not attempting to validate it because there's no input control to validate. On the server, the behaviour will vary according to which validation runner you're using.
精彩评论