JqGrid ignores client-side validation on base class properties

Dec 30, 2012 at 3:45 PM

Hi,

suppose I have the following classes:

    public class Product
    {
        [Key]
        public long Id { get; set; }

        [Required(ErrorMessageResourceName = "ValidationError_NameRequired", ErrorMessageResourceType = typeof(ProductLP))]
        [MaxLength(50, ErrorMessageResourceName = "ValidationError_NameLength", ErrorMessageResourceType = typeof(ProductLP))]
        [Display(Name = "Display_Name", ResourceType = typeof(ProductLP))]
        public string Name { get; set; }
   }

 

 

public class ProductViewModel : Product
    {
        private string productTypeName = "";

        [Required(ErrorMessageResourceName = "ValidationError_ProductTypeRequired", ErrorMessageResourceType = typeof(ProductLP))]
        [Display(Name = "Display_ProductTypeName", ResourceType = typeof(ProductLP))]
        public string ProductTypeName
        {
            get
            {
                return (base.ProductType == null ? productTypeName : base.ProductType.Name);
            }
            set
            {
                productTypeName = value;
            }
        }
   }
Noticed that JqGrid ignores the [Required] client side validation for the property "Name" of the base class in the Add dialog, in the same time the validation is working fine for the property "ProductTypeName" of the driven class
Also it ignores the validation text in the property ProductTypeName and generates it's own validation text


I'm using the Import Configuration sample you provided, is it the reason?

 

Thanks