I’m curious to find out if it is possible to override the [Required] attribute that has been set on a model. I’m sure there most be a simple solution to this problem, any takers?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depends on what precisely you are doing. If you are working with a subclass, using the model with the Required attribute as the base, you can do this:
Redefine the property with the
newkeyword, rather than override it.If you simply want to bind or validate a model, but skip the Required property in your controller, you can do something like: