Extending EntLib VAB - Part 2.2: Enable unobtrusive jQuery validation for Custom Validator

3 comments


Note: Thank you for visiting my blog. However, this blog is not maintained actively anymore. This post is now also in my new blog. Feel free to leave a comment there.

… Continuation from Extending EntLib VAB - Part 2.1: Create custom validators and integrate that with EntLib CABC.

Now lets see how we can enable client side unobtrusive validation for this custom validator by creating adapter for the same and adding the adapter in our custom implementation of DataAnnotationsModelValidatorProvider  (explained in Extending EntLib VAB - Part 1: Enable client side support EntLib VAB and align the validation error keys with MVC ModelState keys) and finally writing unobtrusive jQuery validation.

Extending EntLib VAB - Part 2.1: Create custom validators and integrate that with EntLib CABC

0 comments


Note: Thank you for visiting my blog. However, this blog is not maintained actively anymore. This post is now also in my new blog. Feel free to leave a comment there.

Here is the second last installment post of this series. If you are interested in checking the earlier posts here are the links: Extending Enterprise Library (EntLib) Validation Application Block (VAB) – Introduction, Extending EntLib VAB - Part 1: Enable client side support EntLib VAB and align the validation error keys with MVC ModelState keys (I strongly suggest to check at least part 1 of this series as we are going to reuse here a component that we have developed in that post).

In this post we will see how to develop a custom validator for EntLib VAB. If you are developing a custom validator, there are several aspects you have to take care for: Obviously the first and foremost is write your actual validator that works on server side and integrate that with CABC, next is to enable client side validation for your validator (now when we are talking about client side validation, in ASP.NET MVC it is important to write the client side validation in jQuery unobtrusive validation to provide your end user similar kind of experience as they have with other Out-Of-The-Box validators) and lastly as you are working with EntLib provide support so that your custom validator also seamlessly integrates with EntLib Configuration Application Block Console (CABC). In this post we are going to cover all of these.