- Home
- Forum
- ASP.NET Core - EJ 2
- How to send decimal number from numeric textbox to contoller without losing point ?
How to send decimal number from numeric textbox to contoller without losing point ?
I have a numberic textbox as following but when i post form point is lost even though model property is decimal. For example i'm entering 55.65. When i post i see 5565M in model data. How can i fix it ?
<ejs-numerictextbox id="clientDiscountAmount" ejs-for="ClientPackage.DiscountAmount" format="#.## TL" placeholder="İndirim Tutarı" cssClass="e-outline" min="0" floatLabelType="Auto"></ejs-numerictextbox>
Thanks
Greetings from Syncfusion support.
- Share the complete Grid code (code for ej_selectAll also)
- Have you modified the Grid value for number field before sending to the server using actionBegin event or some other event, please share the details if any
- If possible, please try to replicate the issue in the given sample
Hi,
Sorry I don't see this before...
Your example works fine. I noticed you use Double for numbers fields, so I create a second field with the name Tasa2 and execute my program.
This is the input screen:
And I receive this in my controller (same order of the previous image)
I try with and without ej_selectAll, and the result is the same.
I believe is something relate with decimal separator. This is my config by the way
UPDATE: With decimal type is the same
|
<ejs-grid id="Grid" . . .
. . .
<e-grid-column field="Freight" headerText="Freight" textAlign="Right" format="N2" width="120"></e-grid-column>
. . .
</e-grid-columns>
</ejs-grid> |
|
<div class="form-row">
<div class="form-group col-md-6">
<ejs-numerictextbox id="Freight" [email protected] format="N2" focus="ej_selectAll" Type="text" placeholder="Freight" floatLabelType="Always"></ejs-numerictextbox>
</div> |
|
public IActionResult Update([FromBody]CRUDModel<Orders> value)
{
var data = order.Where(or => or.OrderID == value.Value.OrderID).FirstOrDefault();
if(data != null)
{
data.OrderID = value.Value.OrderID;
data.CustomerID = value.Value.CustomerID;
data.EmployeeID = value.Value.EmployeeID;
data.OrderDate = value.Value.OrderDate;
data.ShipCity = value.Value.ShipCity;
data.Freight = value.Value.Freight;
data.Verified = value.Value.Verified;
}
return Json(value.Value);
} |
- Please ensure that you are using the latest version Syncfusion scripts
- Please try to replicate the reported issue in the given sample
- If possible, please share the issue replicable sample
Hi,
It's not working... but I believe this is related to this
#259941- Now, numeric textbox model value is formatted with server decimal separator before post to the server instead of model value when submitting the form. (https://ej2.syncfusion.com/aspnetcore/documentation/release-notes/18.1.43/?type=all)
This is what I need to change
The comma for a point.
Hi,
Sorry but I don't found the solution, just the cause of the problem as explain before.
My app requires to manage date in dd-MM-yyyy and decimals with points. If I use es-CL culture I solve the date part, but not the number; in other hands, if I set en-US I solve the numbers but not the dates... any idea how to mix two cultures?
Jaime
|
[Index.cshtml]
<script>
document.addEventListener('DOMContentLoaded', function () {
var L10n = ej.base.L10n;
loadCultureFiles('es-CL');
ej.base.setCulture('es-CL');
}); |
- 12 Replies
- 4 Participants
-
TÜ Tümer
- May 29, 2020 01:20 PM UTC
- Jul 13, 2021 01:45 PM UTC