I am having some problems with decimal checking in my application. For example, if I write “14.25” in the text box, which is correct for my culture, this does not allow checking on the client side. Also, if I write 14.25, the point is deleted and 1425 is placed in the property of the entity, and in addition, after SaveChanges, the value stored in the database table is 999.99. Need advice on this. This is related to my other question:
https://stackoverflow.com/questions/24186365/set-jquery-culture-once-for-the-entire-aplication-possible/24186535#24186535
EDIT : Added code, it is as simple as this, I thought that I would not be needed, as this should be a common problem.
[DisplayFormat( DataFormatString = "{0:n2}", ApplyFormatInEditMode = true )]
public decimal Peso { get; set; }
@Html.LabelFor(model => Model.Peso)
<div class="input-control text" data-role="input-control">
@Html.EditorFor(model => Model.Peso)
@Html.ValidationMessageFor(model => Model.Peso)
</div>
E-bat source
share