The “X” property on “Y” could not be set to a 'null' value. You must set this property to a non-null value of type 'Int32'

前端 未结 11 1417
花落未央
花落未央 2020-12-29 21:38

When I run my application and I click a specific button I get the error:

\"The \"X\" property on \"Y\" could not be set to a \'null\' value. You must set thi         


        
11条回答
  •  清酒与你
    2020-12-29 22:06

    I just replace data type int to int32?

    public Int32 Field{ get; set; }
    

    to

    public Int32? Field{ get; set; }
    

    and the problem is solved

提交回复
热议问题