This project is read-only.

Important: xVal is recommended for use only with ASP.NET MVC 1.0

If you're using ASP.NET MVC 2.0 or later, the framework has built-in support for generating client-side validation logic directly from model metadata. You can still use xVal if you wish, but it won't be actively developed or supported.

Project Description

xVal is a validation framework for ASP.NET MVC applications. It makes it easy to link up your choice of server-side validation mechanism with your choice of client-side validation library, neatly fitting both into ASP.NET MVC architecture and conventions.


  • Define your validation rules using attributes on model properties, e.g.,
[Required] [StringLength(50)] public string Name { get; set; }

(Or, if you prefer, you can supply rules programatically or you can just hard-code them in specific views)

  • Designed to fit into ASP.NET MVC conventions for handling form posts and storing and retrieving error information in ModelState
  • Use your choice of server-side validation framework. Out of the box, xVal lets you use .NET 3.5's built-in DataAnnotations classes or Castle Validator (or both). If you want to use something different, you can create your own provider just by implementing IRulesProvider.
  • Use your choice of client-side validation library. Out of the box, xVal lets you use jQuery Validation or ASP.NET's native client-side validation library (a.k.a. WebUIValidation.js, as used by WebForms). Or, use any other client-side validation library by writing a plug-in to configure it using xVal's standard JSON rules description format.
  • Supports localized error messages using resource files. Vary the language of your validation messages according to the current thread's culture.
  • Add custom validation logic that runs both on the server and on the client, either by subclassing an existing rule or by referencing a custom JavaScript function

How to use xVal

For more information, and to see a quick tutorial, see this blog post. Further enhancements are planned To Do.

Last edited Nov 1, 2010 at 7:12 PM by SteveSanderson, version 8