Subscribe to this list via RSS Blog posts tagged in validation
How to Avoid Cut and Paste Code with ASP.NET MVC 2 Model Validation In this post, I will demonstrate how to make your own model validation attributes in order to share common validations throughout an ASP.NET MVC application, and which support MVC 2's client-side validation feature. Validating a ZIP Code As an example, consider a model for an address. public class EditModel { public Guid Id { get; set; } public string Address1 { get; set; } public string Address2 { get; set; } public string City { get; set; } public string State { ...
How Does Html.EnableClientValidation() Inject JavaScript? For a project I'm currently working on, I have a need to add some JavaScript at the end of a page in an ASP.NET MVC application. Since this is part of what Html.EnableClientValidation does, I thought that I would check out that source code to see if there was any kind of generalized mechanism for this. No such luck, I'm afraid. But I did learn a bit more about how Html.EnableClientValidation works, so I thought I might write that down in case it turned out to be useful someday. The Html.Enabl...

Posted by on in Blogs
Customizing jQuery Validation While doing some bug fixing and cleanup in a web application, I had the chance to go a little deeper into the jQuery user input validation framework. There are many tutorials available about implementing custom validations. But what I wanted to do was to extend the default validations with my own code, while preserving the existing functionality, and to do it site-wide. So let's pretend that I'd like to extend the default "required" validation in such a way that you are not allowed to enter "...
  • Page :
  • 1

Check out more tips and tricks in this development video: