[フレーム]
Last Updated: February 25, 2016
·
6.082K
· iondrimba

Removing Custom Validation from Class in asp.net mvc 3/4

If you need to remove a custom validation attribute from a class before saving it but you don ́t have access to the class file, you can remove it at runtime.

public ActionResult Save (Type object)
{
 ModelState.Remove("objectPropertyName");

 if(ModelState.isValid)
 { 
 //continue saving procedure 
 }
 return View();
}

AltStyle によって変換されたページ (->オリジナル) /