ASP.NET MVC 5 Client-Side Form Validation Using jQuery And Bootstrap With Model Class
Here's a simple client side validation in ASP.NET MVC 5. By default, the application's unobtrusive validation has been set to true in web.config file. For this demo, I did not include a saving process to database. I just added a simple view to indicate a success if the model passed to the controller is valid. See files and screenshots below: Registration.cs (This should be created inside the Model folder) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 public class Registration { [Required(ErrorMessage = "You must provide your first name")] [Display(Name = "First Name")] public string FirstName { get ; set ; } [Required(ErrorMessage = "You must provide your last name")] [Display(Name = "Last Name")] public string LastName { get ; set ; } [Required(ErrorMessage = "You must provide your middle name")]