title: ASP.NET MVC Form and double fields
body: <p>I'm developing an asp.net mvc portal to manage GPS coordinates using localDB. My model is:</p>
  
  <pre><code>public class GpsCoordinateViewModel
  {
      double Latitute { get; set; }
      double Longitude { get; set; }
  }
  </code></pre>
  
  <p>the autogenerated adn related View to create a new GpsCoordinate is:</p>
  
  <pre><code>@{
      ViewBag.Title = "Create";
  }
  
  &lt;h2&gt;Create&lt;/h2&gt;
  @using (Html.BeginForm()) {
      @Html.AntiForgeryToken()
      @Html.ValidationSummary(true)
  
  &lt;fieldset&gt;
      &lt;legend&gt;GpsCoordinateViewModel&lt;/legend&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Latitude)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.Latitude)
          @Html.ValidationMessageFor(model =&gt; model.Latitude)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Longitude)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.Longitude)
          @Html.ValidationMessageFor(model =&gt; model.Longitude)
      &lt;/div&gt;
      &lt;p&gt;
          &lt;input type="submit" value="Create" /&gt;
      &lt;/p&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>&lt;div&gt;
      @Html.ActionLink("Back to List", "Index")
  &lt;/div&gt;
  
  @section Scripts {
      @Scripts.Render("~/bundles/jqueryval")
  }
  </code></pre>
  
  <p>the problem is that when I insert as Latitude: 41.213321 and  Longitude: 12.123432 (eg), using breakpoin local values are: Latitude: 41213321 Longitude: 12123432.
  I need to use double because of location's accuracy, but how?</p>
  
  <p>I also read this questions :
  <a href="https://stackoverflow.com/questions/5080451/how-should-i-use-editorfor-in-mvc-for-a-currency-money-type">How should I use EditorFor() in MVC for a currency/money type?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/7375729/mvc3-3-decimal-places-on-type-double-with-leading-zero">MVC3 - 3 decimal places on type double with leading zero</a></p>
  
  <p>but the solutions didn't work for me.
  Any suggestion?</p>
  
  <p>EDIT:
  My webconfig  is:</p>
  
  <pre><code>&lt;system.web&gt;
  &lt;httpHandlers&gt;
    &lt;add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/&gt;
  &lt;/httpHandlers&gt;
  
  &lt;!--
      Enabling request validation in view pages would cause validation to occur
      after the input has already been processed by the controller. By default
      MVC performs request validation before a controller processes the input.
      To change this behavior apply the ValidateInputAttribute to a
      controller or action.
  --&gt;
  &lt;pages
      validateRequest="false"
      pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
      pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
      userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=number"&gt;
    &lt;controls&gt;
      &lt;add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=number" namespace="System.Web.Mvc" tagPrefix="mvc" /&gt;
    &lt;/controls&gt;
  &lt;/pages&gt;
  &lt;globalization culture="en-US" uiCulture="en-US" /&gt;
  </code></pre>
  
  <p></p>