Hi All,
I am new to EPiServer. I am using IValidate interface for validating the default property of episerver page i.e CategoryList. I would like to restrict the count of category selection for example say only one category should be selected. I did this for a single pagetype, But i am getting the following exception , while adding additional page types,"Ambiguous match found". It may be simple one i may not know. I have attached my code below.
public class BasePageValidator : IValidate,IValidate
{
IEnumerable IValidate.Validate(SamplePage page)
{
if (page != null && page.Category.Count > 1)
{
return new[]
{
new ValidationError()
{
ErrorMessage = "Field IntroText cannot be empty!",
PropertyName = page.GetPropertyName(pg => pg.Category),
Severity = ValidationErrorSeverity.Warning,
ValidationType = ValidationErrorType.AttributeMatched
}
};
}
return Enumerable.Empty();;
}
IEnumerable IValidate.Validate(Products page)
{
return Enumerable.Empty();
}
}
It is not working after adding "IValidate
I need to set this restriction for some pagetypes more than one. Suggest me on how to achive this one.
Thanks in advance.