Is it possible to make a domain decimal field not required

Feb 19, 2013 at 4:12 PM
Hi, everyone, does anyone know how to make a domain field of type decimal to accept null value?
Feb 19, 2013 at 4:28 PM
Have you tried
public decimal? propertyName { get; set;}
The only thing is when accepting input from the user you make have to do something like
 if (textbox1.text == string.Empty)
   propertyName = null;
   propertyName = Convert.ToDecimal(textbox1.text);
Feb 20, 2013 at 12:42 PM
Edited Feb 20, 2013 at 12:47 PM
Thanks for your advice
Changed from decimal to nullable decimal, that doesn't help. I need the field Price in the form connected to be optional, if user doesn't watnt to write price, then it may be left blank, but if the price is needed it should be possible to write it. The same thing with another field of integer type

I've also tried to set the [Required(AllowEmptyStrings = true)] attribute to the field, still doesn't work