Setting Locale property

I'm trying to set Locale property to my NumericTextBox.

I have the control in a view:


And in the same view I have the script:


So, when the page loads, the input boxes looks like this:


But when I enter and exit the control for typing, the number format is what I want to get when the page loads:


I'm sure I'm missing something.

Thanks!

5 Replies

BJ Bernard Jurlina May 3, 2018 08:31 PM UTC

And one more things.
Do I have to do this in all the views where I want to change locale property on the controls?
Or there is a way to do this in one place for all the views and all the controls?

Thanks!
Bernard.


PR Piramanayagam Ramakrishnan Syncfusion Team May 4, 2018 12:49 PM UTC

 
We have checked your query. The reported issue is occurred when the culture scripts are loaded after the control is rendered. To avoid this problem, add the script in head tag instead of body.  
 
You can add the culture scripts in common place like _Layout.cshtml page.  You no need to add these in all views page. Please refer to the below code example. 
 
[_Layout.cshtml] 
 
<!DOCTYPE html> 
<html lang="en"> 
    <head> 
        <meta charset="utf-8" /> 
        <title>@ViewBag.Title - My ASP.NET MVC Application</title> 
        <link rel='nofollow' href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /> 
        <meta name="viewport" content="width=device-width" /> 
        <link rel="stylesheet" rel='nofollow' href="https://cdn.syncfusion.com/ej2/bootstrap.css" /> 
        <script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js"></script> 
        @Styles.Render("~/Content/css") 
        @Scripts.Render("~/bundles/modernizr") 
        <script> 
            function loadCultureFiles() { 
                var files = ['numbers.json']; 
                var loader = ej.base.loadCldr; 
                var loadCulture = function () { 
                    var val, ajax; 
                    ajax = new ej.base.Ajax('@Url.Content("~/Scripts/cldr-data/main/hr/")' + files[prop], 'GET', false); 
                    ajax.onSuccess = function (value) { 
                        val = value; 
                    }; 
                    ajax.send(); 
                    loader(JSON.parse(val)); 
                }; 
                for (var prop = 0; prop < files.length; prop++) { 
                    loadCulture(); 
                } 
            } 
            loadCultureFiles(); 
        </script> 
    </head> 
    <body> 
        ... 
        @RenderBody() 
        @Html.EJS().ScriptManager() 
        ... 
    </body> 
</html> 
 
For your reference, we have prepared a sample based on this and it can be downloaded from the link: Sample 
 
Please let us know whether the provided sample is helpful in achieving your requirement. If not, revert with more information to proceed further. 
 
Regards, 
Piramanayagam R 



BJ Bernard Jurlina May 4, 2018 05:45 PM UTC

Excellent,

it's working great when I'm testing it from the visual studio project.
But when I deploy it to the web server, I'm getting this



Surely, I forgot something to deploy?

Thanks!
Bernard.


BJ Bernard Jurlina May 4, 2018 06:37 PM UTC

It's ok. I had to add



in web.config.

Bernard.


PR Piramanayagam Ramakrishnan Syncfusion Team May 7, 2018 04:43 AM UTC

Hi Bernard Jurlina, 
 
We glad to hear that, reported issue is resolved in NumericTextBox component. Please let us know further assistance on this. We will be happy to assist you. 
 
Regards, 
Piramanayagam R 


Loader.
Up arrow icon