Custom Culture RRS feed

  • Question

  • User1950453299 posted


    We are using en-ZA in our web.config to set the Culture for our Web site.

    However the Decimal seperator for Numbers and Currency is a "Comma" (,) and not a "period" (.)

    We have changed the sperator for the culture on the Server's Regional Settings and Copied and Applied to all System Accounts. 

    Our Controls still display the Default Seperator and not the customized seperator.

    Is there an easy way to force the application to use the customized culture. We are using Windows 2012 Server and IIS 8.


    Wednesday, April 10, 2013 10:43 AM


  • User1508394307 posted

    It seems that comma is coming when setting en-ZA in .NET and not from system settings.

    You can try to set custom NumberDecimalSeparator like this

    <%@ Import Namespace="System" %>
    <%@ Import Namespace="System.Threading" %>
    <%@ Import Namespace="System.Globalization" %>
    <%@ Page Language="c#" culture="en-ZA" %>
    <script runat="server">
      void Page_Load(object sender, System.EventArgs e)
        double x=0.95;
        Response.Write("x=" + x);
        CultureInfo myCI = (CultureInfo)CurrentThread.CurrentCulture.Clone ();
        myCI.NumberFormat.NumberDecimalSeparator = ",";
        CurrentThread.CurrentCulture = myCI;
        Response.Write("x=" + x);

    To use with MVC you can try override InitializeCulture (see example here).

    Hope this helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 10, 2013 12:01 PM