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
close icon

Binding double values ignores decimal symbol, always returning int

Is there a way to use EjsNumericTextBox binded to double value.

Whatever I did try to construct EjsNumericTextBox to use decimal values , binded value always getting integer  number without decimal pointer. 

My culture is set to HR (Croatian) and I am trying to set , (comma) as decimal pointer.

I am using Blazor componets instaled by nuget version 17.4.0.39

Here is my one of my attempts to bind decimal.


    @page "/NumericTest"

    @using Syncfusion.EJ2.Blazor.Inputs

    <EjsNumericTextBox TValue="double?" 

                       Decimals="2" 

                       Placeholder="Iznos računa" 

                       Min="0" 

                       Locale="hr" 

                       @bind-Value="@iznos"

                       Format="C2"

                       ></EjsNumericTextBox>

    <hr />

    <span >@( iznos.HasValue ? iznos.Value.ToString("0.00") : "Set value")</span>

    @code {

        [Inject]

        protected IJSRuntime JsRuntime { get; set; }


        private double? iznos { get; set; } = 12.34;


        protected override async Task OnInitializedAsync()

        {

            await base.OnInitializedAsync();

            this.JsRuntime.Ejs().LoadLocaleData("wwwroot/ej2-locale/src/hr.json").LoadCldrData("wwwroot/cldr-data/main/hr/numbers.json", "wwwroot/cldr-data/main/hr/timeZoneNames.json", "wwwroot/cldr-data/main/bs/ca-gregorian.json", "wwwroot/cldr-data/main/hr/currencies.json", "wwwroot/cldr-data/supplemental/numberingSystems.json").SetCulture("hr").SetCurrencyCode("HRK");

        }

    }



12 Replies

SD Saranya Dhayalan Syncfusion Team December 19, 2019 07:11 AM UTC

Hi Admir, 
 
Thank you for contacting Syncfusion support, 
 
We have checked your reported issue, we are not able to reproduce the issue in our end. We have created the video for your reported issue. Please find the below video link: 
 
 
Could you please refer the latest script file as mentioned in the below? 
 
<link rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.4.39/material.css" rel="stylesheet" /> 
<script src="https://cdn.syncfusion.com/ej2/17.4.39/dist/ej2.min.js"></script> 
<script src="https://cdn.syncfusion.com/ej2/17.4.39/dist/ejs.interop.min.js"></script> 
 
 
Could you please check the above video & sample and get back to us for further assistance on this? 
 
Regards, 
Saranya D 



JS Jan Schimmelmann February 9, 2020 08:26 AM UTC

Hi Saranya,

I've the same problem as Admir with the German culture settings. I tried your example project (BlazorApp5) and installed the globilization settings as descripted here:
https://ej2.syncfusion.com/blazor/documentation/numerictextbox/globalization/?no-cache=1

When I start the project I get the same behaviour that decimals are returned as int (see attached screenshot).

Best regards,
Jan

Attachment: syncnumeric_913caea1.rar


AH Admir Hodžic February 9, 2020 12:06 PM UTC

Jan is correct Issue is still there. I just did not have patience to request support again.

In sample Syncfusion provided bindg decamls works from codebehind to gui.
But binding user inputs to codebehind ignores decinal points.


PM Ponmani Murugaiyan Syncfusion Team February 11, 2020 04:46 PM UTC

Hi Admir, 
  
Sorry for the inconvience caused. 
  
We have checked with your screenshot and sample code attached. We suspect that, whether in your code are you trying to override the number format using specified separator. 
  
We have checked with the below cases to reproduce the reported issue. 
  1. Changed the browser culture to your locale 
  2. Ensured with given culture 
  3. Modified system language 
Please provide the below details to provide you the solution at earliest. 
  1. Whether you have override the number format in your sample. 
  2. Provide the browser culture, you have used. 
  3. Please provide the issue reproducing sample. 
Regards, 
Ponmani M 



JS Jan Schimmelmann February 11, 2020 08:48 PM UTC

Hi Ponmani,

I've tested the issue with a Firefox and a Chrome browser. My browser culture settings are "German" and my system language is also "German". As Admir said, in code behind everthing works well. But if you want to change the value in the browser, the comma is ignored and not the decimal value is returned but an integer.

I've provided an sample project which is basically Admirs source code. I just changed the culture settings to German.

Funny fact: the Syncfusion WPF component DoubleTextBox faces the exact same issue. I've attached a second sample project for that issue as sell. You can find both projects inside the zip file.

Best regards,
Jan Schimmelmann

Attachment: BlazorAndWpfApp_8bc1deea.zip


PM Ponmani Murugaiyan Syncfusion Team February 12, 2020 04:01 PM UTC

Hi Jan, 
  
Sorry for the inconvience caused. Unfortunately, we could not reproduce the issue from our side with the sample application you have attached (Blazor serve app). 
  
We have made changes to the following configrations in our end and ensured the reported scenario from our side. 
  
1. We have changed the browser culture to "German". 
  
   
  
2. We have also changed the system format to "German". 
 
   
 
  
We have attached a vedio demonstration of our test scenario, kindly refer to the following links. 
  
  
  
 Output screenshot: 
  
   
  
  
Please provide us the following information. 
  
 1. Confirm whether you have used blazor client side or blazor side application. We have checked the reported issue in client side blazor application, the issue has been reproduced in our end and we have already considered it as bug. But the issue is not replicated in server side application. 
  
 2. Kindly chek the above vedio and sample and let us know whether we have missed any configration or steps to replicate the issue in our end. 
  
 The above infomation will help us provide a prompt solution. 
  
Regards, 
Ponmani M 



PG Pon Geetha A J Syncfusion Team February 13, 2020 05:41 AM UTC

Dear Syncfusion support, 
 
I cannot see the images in the e-mail you sent me. I told Outlook to download the images but they cannot be displayed either. Please send the e-mail again or tell me another way to see the images. 
Thanks. 

Best regards, 
Jan Schimmelmann 



PM Ponmani Murugaiyan Syncfusion Team February 14, 2020 02:42 AM UTC

Hi Jan, 

Images might not be rendered due to any firewall/network related restrictions from the your side. As an alternate for viewing the images, we suggest you to check with the Syncfusion site with the below link: 



Query : The Syncfusion WPF component DoubleTextBox faces the exact same issue. I've attached a second sample project for that issue as sell. You can find both projects inside the zip file. 

We have checked the reported query “Only the integer value is updated in DoubleTextBox when binded to TextBox” and the DoubleTextBox works well as shown in below video.  

 
Regards, 
Ponmani M 
 



DT Dimitrios Tsarouchis February 14, 2020 01:36 PM UTC

Hi,

In Blazor Server App, when you want to use double values in EjsNumericTextBox binded value always returns value as integer, independently if you use some specific locale. In my sample app I use Greek locale (decimals with comma). 

a) I have put 2 numeric text boxes. In the first numeric text box on loading i assign on bind value 12,34 . When i run the application it shows 12,00 on the numeric text box. 

b) I am showing bind value of the first numeric text box in a <span> element. In the span shows 12. If I change the value of the first numeric text box e.g. 111,35 the span shows 11135.

c) When I assign null in bind value it does the following:


c) I have a button. When i press it i change the bind value on the first numeric text box to 16,38 and also assign the bind value of the first to second numeric text box. It shows correctly 16,38 in the two numeric text boxes.


Attachment: TestBlazor_d0e71afc.7z


SP Sureshkumar P Syncfusion Team February 17, 2020 09:05 AM UTC

Hi Dimitrios, 
 
Query 1: In Blazor Server App, when you want to use double values in EjsNumericTextBox binded value always returns value as integer. 
 
Answer:  
            Thank you for updating the issue reproduced sample. We can reproduce the reported issue when we reset the browser language to Greek and system date, time or number format to Greek (Cyprus). We have confirmed this as a bug at our end. We will fix and include the solution on our March first week patch release, which is expected to be rolled out on March 3rd, 2020. Please be patient until then. 
 
You can track the status of this problem by using the below feedback portal. 
 
 
Query 2: c) When I assign null in bind value it does the following:  
 
Answer:  
            We were able to replicate your reported problem. We have confirmed this as a bug at our end. We will fix and include the solution on our next week patch release, which is expected to be rolled out on February 25th, 2020. Please be patient until then. 
 
You can track the status of this problem by using the below feedback portal. 
 
 
Regards, 
Sureshkumar P 



AH Admir Hodžic February 21, 2020 03:31 PM UTC

In Blazor Server App, when you want to use double values in EjsNumericTextBox binded value always returns value as integer. 

Looks like in version 17.4.50 binding decimal pointer now works ok.

Look like there is still bug with binding null value, 


SP Sureshkumar P Syncfusion Team February 24, 2020 06:24 AM UTC

Hi Admir, 
 
Thanks for your update. 
 
As we promised earlier, we will intimate you once the fix will be rolled out. 
 
Regards, 
Sureshkumar p 


Loader.
Live Chat Icon For mobile
Up arrow icon