0
votes
How to Avoid Cut and Paste Code with ASP.NET MVC 2 Model Validation
Craig Stuntz's Weblog
– 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 { get; set; } public string ZIP { get; set; } } Now I would like to add a validation attribute in ...
Statistics
|
Visits by Source |
User Actions |




