I\'ve got a situation where I\'m uploading an image the user has selected from his local file system. My Form in my view, basically has two submit buttons. One is used to
I use it sometimes, so I've made an extension method out of it:
public static ModelStateDictionary ClearError(this ModelStateDictionary m, string fieldName)
{
if (m.ContainsKey(fieldName))
m[fieldName].Errors.Clear();
return m;
}
It can be used fluently to clear error for multiple fields.