We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Value decimal not working

Thread ID:





140976 Nov 16,2018 02:18 PM UTC Nov 19,2018 11:24 AM UTC ASP.NET Core - EJ 2 1
Tags: Numeric TextBox
Mini Dev
Asked On November 16, 2018 02:18 PM UTC

I have the following numeric textbox component:

<input id="priceTextBoxEdit" name="Price" />

<script type="text/javascript">
    function runPriceTextBoxEdit() {
        let numericTextBox = new ej.inputs.NumericTextBox({
            currency: "EUR",
            decimals: 4,
            format: "c4",
            min: 1.0,
            placeholder: "Price",
            step: 1.0,
            value: @Model.Price.ToString().Replace(",", ".")

When I insert a decimal such as 2.50 it's displayed it correctly but when I submit the form, my Model.Price (public decimal? Price { get; set; }) is 250 and not 2.52.
The dot is removed.. Why? Where could be the problem?


Christopher Issac Sunder K [Syncfusion]
Replied On November 19, 2018 11:24 AM UTC

Hi Mini, 

Thank you for contacting Syncfusion support. 

We have checked your reported issue and provided code block at our end. It seems you are using decimal data(value: @Model.value.ToString().Replace(",", ".")) which is unclear for us. You don’t need to do the replace operation in NumericTextBox component initialization. Could you please ensure the bounded NumericTextBox data value and datatype at your end? 

The NumericTextBox has a text input, so we can assign the NumericTextBox component value as string datatype. If you are unable to resolve the problem on above suggestion, you can specify the Form Post back data as string to resolve it. 

public IActionResult Index(string Price) 
   return Content($"NumericTextBox value is: {Price}"); 

Please let us know if you need any further assistance on this. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon