Validation Framework in .NET that can do edits between fields

前端 未结 2 1064
遇见更好的自我
遇见更好的自我 2020-12-18 10:22

From my experience many validation frameworks in .NET allow you to validate a single field at a time for doing things like ensuring a field is a postal code or email address

2条回答
  •  無奈伤痛
    2020-12-18 11:12

    I build custom validation controls when I need anything that's not included out of the box. The nice thing here is that these custom validators are re-usable and they can act on multiple fields. Here's an example I posted to CodeProject of an AtLeastOneOf validator that lets you require that at least one field in a group has a value:

    http://www.codeproject.com/KB/validation/AtLeastOneOfValidator.aspx

    The code included in the download should work as an easy to follow sample of how you could go about it. The downside here is that Validation controls included with ASP.Net don't often work well with asp.net-ajax.

提交回复
热议问题