How does one get the GridView to detect property validation attribute violations when they are specified in a buddy class? For example, the property attributes in the buddy class below are not respected by the GridView. I.e., the grid doesn't indicate a validation error for and it permits entry of a part number that doesn't match the regex. By contrast, the GridView does respect the IValidatableObject.Validate method. I've tried making the PartMetadata class public; but it still didn't validate.
Any ideas? thanks!
Any ideas? thanks!
[MetadataType(typeof(Part.PartMetadata))]public partial class Part : IValidatableObject { private sealed class PartMetadata { [RegularExpression(@"[0-9A-F]{4,20}")] // Not respected by the RadGridView public string PartNumber { get; set; } } public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { if (PartNumber == DrawingNumber) { yield return new ValidationResult("part number = drawing number", new string[] { "PartNumber", "DrawingNumber" }); } }}