The last Ajax feature we will look at in this chapter is remote validation. This is a hybrid of the model validation techniques I showed you in Chapter 29. The validity of a property is evaluated by an action method invoked using an Ajax call at the client. The first step in setting up remote validation is to add an action method to the controller to perform the evaluation. Listing 30-15 shows such a method, which I have added to the
RegistrationController class since this is the controller that contains the validation logic from Chapter 29.
Listing 30-15. Adding a remote validation action method to a controller
using System; using System.Linq; using System.Web.Mvc; using EventRegistration.Models.Domain; using EventRegistration.Models.Domain.Repository; ...