How to specify a min but no max decimal using the range data annotation attribute?

后端 未结 10 1740
旧时难觅i
旧时难觅i 2021-01-31 01:02

I would like to specify that a decimal field for a price must be >= 0 but I don\'t really want to impose a max value.

Here\'s what I have so far...I\'m not sure what the

10条回答
  •  广开言路
    2021-01-31 01:31

    using Range with

    [Range(typeof(Decimal), "0", "9999", ErrorMessage = "{0} must be a decimal/number between {1} and {2}.")]
    
    [Range(typeof(Decimal),"0.0", "1000000000000000000"]
    

    Hope it will help

提交回复
热议问题