I’ve tried to extend the RequiredAttribute to make some localizations. I wrote this:
public class LocalizedRequiredAttribute : RequiredAttribute
{
public LocalizedRequiredAttribute(string errorMessageResourceName)
{
this.ErrorMessageResourceName = string.IsNullOrEmpty(errorMessageResourceName) ? "Required_ValidationError" : errorMessageResourceName;
ErrorMessageResourceType = typeof(bop.Core.Resources.Label);
}
}
At the client side no validation message is rendered. What is wrong?
Thanks for help.
Luca
In your followup comment, you specified that clientside validation wasn’t working. It looks like you asked this same question here, but for the sake of StackOverflow, I will provide the answer.
The
LocalizedRequiredAttributeclass must also implementIClientValidatableto get clientside validation to work: