I created a view based on a model using MVC C # in this model I have a property for the cost of an event, which according to my country can contain the following valid values (separated by hyphen): $ 1,234.56 - $ 123,123 , 54 - $ 1.25 and the property with validations using data annotations is:
[Required(ErrorMessage="Especifique precio evento")]
[Display(Name="Precio Evento")]
[DisplayFormat(DataFormatString = "{0:C0}")]
[RegularExpression(@"^(((\d{1,3})(,\d{3})*)|(\d+))(.\d+)?$", ErrorMessage = "Error")]
public double PrecioEvento { get; set; }
my problem is that when I send to my form, in the controller I receive these values 1.25 - 25.47 - 789.32 of PriceEvent ... but when the value specified for PriceEvent takes a comma for example 123,123.45 I receive 0.0 in my controller.
at the beginning every time I wrote a number with a decimal point I received zero in my controller but I fixed it by adding this to my web.config
<globalization culture="es-SV"/>
but now I do not know what I should modify to get in my controller values specified in my view that have a comma (thousands) and a decimal point, for example: 123,123.45.
Thanks for the help, Note: the regular expression I use works to get the desired values (comma of thousands and decimal point).