Removing Required Attribute from Class but MVC3 still won't post the form without a value in the text box

前端 未结 2 985
借酒劲吻你
借酒劲吻你 2021-01-12 07:50

I have a class. At one point, I had set the properties of the class to [Required] using System.ComponentModel....

Okay, then I realized this was not needed. I ha

2条回答
  •  醉酒成梦
    2021-01-12 08:18

    You have two options:

    1. Set property as nullable,
    2. Turn off required attribute for value types (see this answer)

提交回复
热议问题