Decimal separator
Hi Team,
How to use dot as decimal separator when the current culture is "es-ES"?
<SfNumericTextBox CssClass="e-outline e-success" TValue=decimal? Placeholder="Importe"
Locale="en">
</SfNumericTextBox>
services.Configure<RequestLocalizationOptions>(options =>
{
// define the list of cultures your app will support
var supportedCultures = new List<CultureInfo>()
{
new CultureInfo("en-US"),
new CultureInfo("es-ES"),
};
// set the default culture
options.DefaultRequestCulture = new RequestCulture("es-ES");
options.SupportedCultures = supportedCultures;
options.SupportedUICultures = supportedCultures;
});
Thanks in advance.
Regards
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
SN
Sevvandhi Nagulan
Syncfusion Team
March 15, 2021 01:43 PM UTC
Hi Jorge,
Greetings from Syncfusion support.
We checked your query. By configuring the dot(“.”) separator in C# through the Startup file's using NumberDecimalSeparator property, we can override the default decimal separator. Please see the code below.
|
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
services.AddSyncfusionBlazor();
services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SampleLocalizer));
services.Configure<RequestLocalizationOptions>(options =>
{
// Define the list of cultures your app will support
var supportedCultures = new List<CultureInfo>()
{
new CultureInfo("en-US"),
new CultureInfo("es-ES")
};
// Set the default culture
var culture = new CultureInfo("es-ES");
culture.NumberFormat.NumberDecimalSeparator = ".";
options.DefaultRequestCulture = new RequestCulture(culture);
options.SupportedCultures = supportedCultures;
options.SupportedUICultures = supportedCultures;
options.RequestCultureProviders = new List<IRequestCultureProvider>() {
new QueryStringRequestCultureProvider() // Here, You can also use other localization provider
};
});
}
|
Please find the sample below.
Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/NumericTextBox_Seperator-879542656
Please find the reference documentation link below.
Please check the above sample and get back to us if you need further assistance.
Regards,
Sevvandhi N
JQ
Jorge Quesada
March 15, 2021 03:22 PM UTC
Hi Sevvandhi N


I tried your project from sample link but it doesn't work. I enter "1.23" and when the control lost focus the resulting number is "123.00"
Thanks
Regards
SN
Sevvandhi Nagulan
Syncfusion Team
March 16, 2021 01:14 PM UTC
Hi Jorge,
We checked the reported issue. To resolve the reported issue, we suggest that you to define the group separator using NumberGroupSeparator property in C# in the Startup.cs file. Please see the code below.
|
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
services.AddSyncfusionBlazor();
services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SampleLocalizer));
services.Configure<RequestLocalizationOptions>(options =>
{
// Define the list of cultures your app will support
var supportedCultures = new List<CultureInfo>()
{
new CultureInfo("en-US"),
new CultureInfo("es-ES")
};
// Set the default culture
var culture = new CultureInfo("es-ES");
culture.NumberFormat.NumberDecimalSeparator = ".";
culture.NumberFormat.NumberGroupSeparator = ",";
options.DefaultRequestCulture = new RequestCulture(culture);
options.SupportedCultures = supportedCultures;
options.SupportedUICultures = supportedCultures;
options.RequestCultureProviders = new List<IRequestCultureProvider>() {
new QueryStringRequestCultureProvider() // Here, You can also use other localization provider
};
});
} |
Screenshot:
Please find the sample below.
Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/NumericTextBox_Seperator1154949933
Please check the above sample and get back to us if you need further assistance.
Regards,
Sevvandhi N
Marked as answer
JQ
Jorge Quesada
March 16, 2021 04:32 PM UTC
Hi Sevvandhi N,
Now it's working, thanks!
Regards
SN
Sevvandhi Nagulan
Syncfusion Team
March 17, 2021 04:33 AM UTC
Hi Jorge,
Thanks for your update.
We are glad to hear that your issue has been resolved. Please get back to us if you need further assistance.
Regards,
Sevvandhi N
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
- Marked answer
-
JQ Jorge Quesada
- Mar 14, 2021 11:59 PM UTC
- Mar 17, 2021 04:33 AM UTC