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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Value decimal not working

Thread ID:

Created:

Updated:

Platform:

Replies:

140976 Nov 16,2018 02:18 PM UTC Nov 19,2018 11:24 AM UTC ASP.NET Core - EJ 2 1
loading
Tags: NumericTextBox
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(",", ".")
        });
        numericTextBox.appendTo('#priceTextBoxEdit');
    }
</script>

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?

Thanks

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. 


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

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

Thanks, 
Christo

CONFIRMATION

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

or the page will be automatically redirected to 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

;