Is there any way to ignore some properties (on a POCO) when validating a form in ASP.NET MVC3?

前端 未结 9 756
春和景丽
春和景丽 2021-02-05 05:59

i\'ve got a sign up wizard for new user registration. When I try to goto the 2nd page, I get validation errors because my User object hasn\'t been fully populated,

9条回答
  •  没有蜡笔的小新
    2021-02-05 06:52

    What about IgnoreModelErrors custom class ?

    http://mrbigglesworth79.blogspot.in/2011/12/partial-validation-with-data.html


    Inherit from the class ActionFilterAttribute, and clear errors[based on matching names or regex patterns] in the OnActionExecuting as demonstrated in the above link. This will be cleaner.

提交回复
热议问题