Inherited properties and MetadataType does not seem to work with client side validation in ASP.NET MVC 2.
The validation of our MetadataTypes work a
Are you sure? I've got a ASP.NET MVC 2 site set up as you describe and I have client side validation of both required and regex based attributes that works fine. It doesn't work with my own validators (that derive from ValidationAttribute) at the moment though:
[MetadataType(typeof(AlbumMetadata))]
public partial class Album {}
public class AlbumMetadata {
[Required(ErrorMessage = "You must supply a caption that is at least 3 characters long.")]
[MinLength(3, ErrorMessage = "The caption must be at least {0} characters long.")]
[RegularExpression(@".{3,}")]
public string Caption { get; set; }
}
(MinLength basically provides a more obvious way to see what's happening in the Regular Expression attribute, which was added for testing)
I then have the following in my view:
<%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm()) {%>
<% } %>
Which results in the following being output to the client below the form tags (formatted for clarity):