Отмечено на карте:

суббота, 26 февраля 2011 г.

In my research for CQRS concept project I want to use ASP.NET DataAnnotations for automatically support validation for my view models, but I want to use in the same way validation rules on client side, in standard DataAnnotations it supports client code associations for standard attributes provided with ASP.NET script. Unfortunately, in current version of ASP.NET MVC 2 doesn't support remote validation using ajax call, in MvcContrib project we can take implementation, but it doesn't meet my requirements and during testing I find some cases where it completely even doesn't be called. Simple case was when we submit form, so we can't process validation result in JavaScript callback, because page have been already sent.
I create additional params, so right now we can control processing remote validation, using jQuery synchronous ability.
JavaScript validation function: