O'Reilly logo

Applied ASP.NET 4 in Context by Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performing Remote Validation

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required