AI OnAI Off
Can you change your logic to an implementation using a validator class that inplements IValidate<YourBlockType> and the Validate method? That way it would be very easy to compare the values from Value1 with Value2.
Also, you might want to check out the System.Web.Mvc.CompareAttribute and decorate your model’s Value2 property with that one.
Hi all,
I need to make custom validation on content area in block.
I`ve used befor custom validation by creating a class which inherits from ValidationAttribute.
What I need to do is to pass Value1 property vale that exists in the same model into validator:
[Display(
Name = "Value1",
GroupName = SystemTabNames.Content,
Order = 1)]
[Required]
public virtual string Value1 { get; set; }
[Display(
Name = "Value2",
GroupName = SystemTabNames.Content,
Order = 2)]
[MyValidator(Value = Value1)]
public virtual string Value2 { get; set; }
Thanks,
Dan