Reputation: 51
When opening a (razor) page containing a number with decimal places (set at 4 in this case) the comma separator is interpreted as a thousands separator which expands the number by it's decimal places as seen in this picture:
This is happening in the administration panel of the NopCommerce 3.8 development tree and only on a remote server. I don't see this issue with my debug build locally so this has probably something to do with server settings or even with underlying database (Microsoft SQL-Server). I'm not sure this is a NopCommerce issue though so I'm not limiting it to that tag.
I know that NopCommerce is forcing the en culture in the Administration panel because of how Kendo Grid works. Again, I'm not sure this has anything to do with the actual issue.
This issue also materializes in the fact that the text box doesn't allow the ',' character. i can only use '.'. Trying to save a number like '0.20' is terminated with the message:
The value '0.2000' is not valid for ...
Update 1 (culture set in Global.asax.cs):
if (webHelper.GetThisPageUrl(false).StartsWith(string.Format("{0}admin", webHelper.GetStoreLocation()),
StringComparison.InvariantCultureIgnoreCase))
{
//admin area
//always set culture to 'en-US'
//we set culture of admin area to 'en-US' because current implementation of Telerik grid
//doesn't work well in other cultures
//e.g., editing decimal value in russian culture
CommonHelper.SetTelerikCulture();
}
else
{
//public store
var workContext = EngineContext.Current.Resolve<IWorkContext>();
var culture = new CultureInfo(workContext.WorkingLanguage.LanguageCulture);
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}
Upvotes: 1
Views: 793
Reputation: 9881
This does seem like an issue with the culture it is using. Try specifying which culture to use in the web.config:
<configuration>
<system.web>
<globalization uiCulture="en" culture="en-US" />
Upvotes: 1