When I do field validation in Asp.Net MVC, it\'s generated the following error css classes :
Here's what I did:
private void ChangeValidationClassNames()
{
var helper = new HtmlHelper(new ViewContext(), new ViewPage());
SetPublicStaticReadonly("ValidationInputCssClassName", helper, "errInput");
SetPublicStaticReadonly("ValidationMessageCssClassName", helper, "errMsg");
}
public void SetPublicStaticReadonly(string readonlyPropName, object instance, object value)
{
var field = instance.GetType().GetField(readonlyPropName, BindingFlags.Static | BindingFlags.Public);
if (field == null)
throw new NullReferenceException(string.Format("public static readonly field '{0}' not found in '{1}'", readonlyPropName, instance));
field.SetValue(instance, value);
}