title: Asp.net MVC decimal symbol issue
body: <p>I have an Asp.net MVC application with a particular view that has a model with a <code>float</code> property.</p>
  
  <p>My server locale says that <code>,</code> is decimal symbol and it works fine when I edit my model and enter for instance <strong>7,5</strong> in the text box and post it to server. Default model binder is able to bind this value as expected to <em>seven and a half</em>.</p>
  
  <p>But when I display this same value using <code>&lt;%= this.Model.FloatValue %&gt;</code>, decimal symbol is converted to <code>.</code> which means that <code>&lt;%= %&gt;</code> obviously ignores server locale settings.</p>
  
  <p>So. How do I solve this problem then? Which locale should be used? Server system locale which says that decimal symbol is <code>,</code> or browser locale setting that's set to <code>en-gb</code>, which means that <code>.</code> is decimal symbol.</p>
  
  <p>Anyway. I just want this to work reliably.</p>
  
  <h2>Some code:</h2>
  
  <p>My controller actions:</p>
  
  <pre><code>public ActionResult Settings()
  {
      Settings result = this.Service.GetActiveSettings();
      return View(result);
  }
  
  [HttpPost]
  [HandleModelStateException]
  public ActionResult Settings(Settings data)
  {
      if (!this.ModelState.IsValid)
      {
          throw new ModelStateException(); // my custom exception which isn't important here
      }
      Settings result = this.Service.SaveSettings(data);
      return Json(result);
  }
  </code></pre>
  
  <p>The second one is called asynchronously using <code>$.ajax()</code>.</p>
  
  <p>Relevant part of the partial view:</p>
  
  <pre><code>&lt;%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl&lt;Settings&gt;" %&gt;
  &lt;div class="data"&gt;Float value: &lt;strong&gt;&lt;%= this.Model.FloatValue %&gt;&lt;/strong&gt;&lt;/data&gt;
  &lt;div class="data"&gt;Integer value: &lt;strong&gt;&lt;%= this.Model.IntValue %&gt;&lt;/strong&gt;&lt;/data&gt;
  ...
  </code></pre>
  
  <p>Any my model class:</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Represents application specific settings.
  /// &lt;/summary&gt;
  public class Settings
  {
      /// &lt;summary&gt;
      /// Gets or sets the integer value.
      /// &lt;/summary&gt;
      /// &lt;value&gt;Integer value.&lt;/value&gt;
      [Required(ErrorMessageResourceType = typeof(Resources.Settings), ErrorMessageResourceName = "QuotaRequired")]
      [Range(0, 365*24, ErrorMessageResourceType = typeof(Resources.Settings), ErrorMessageResourceName = "QuotaRange")]
      public int IntValue { get; set; }
  
      [Required(ErrorMessageResourceType = typeof(Resources.Settings), ErrorMessageResourceName = "WorkdayRequired")]
      [Range(.5, 24.0, ErrorMessageResourceType = typeof(Resources.Settings), ErrorMessageResourceName = "WorkdayRange")]
      public float FloatValue { get; set; }
  }
  </code></pre>
  
  <p>As you may see, there's nothing unusual here. Oh and BTW: Range validation on <code>FloatValue</code> doesn't work either.</p>