ASP.NET MVC optional field being treated as required

前端 未结 6 2014
被撕碎了的回忆
被撕碎了的回忆 2020-12-15 02:57

I have this field that for some reason when I click on submit, gets a validation message that the field is required.

[DisplayName(\"Total Budget:\")]
public          


        
6条回答
  •  無奈伤痛
    2020-12-15 03:45

    You probably change Budget from a double to double?

    You probably can try adding this attribute to the controller

    BindExclude([Bind(Exclude="Budget")]) as well

提交回复
热议问题