title: Validation Message For Range Attribute MVC
body: <p>The following Model has Required attributes for certain parameters:</p>
  
  <pre><code>   public class EModel
      {        
          [Required]
          [Display(Name = "Name")]
          public string Name { get; set; }
  
          [Required]
          [Display(Name = "Tel")]
          public string Phone { get; set; }
  
          public float Long { get; set; }
          public float Lat{ get; set; }
      }
  </code></pre>
  
  <p>In my Views, I have Name, Phone, and 2 float Parameters: longitude and latitude that I keep in a hidden input, they are set by a map marker to be saved later.</p>
  
  <p>I am validating the required parameters like the following:</p>
  
  <pre><code>&lt;div&gt;
      @Html.EditorFor(model =&gt; model.Name, new { htmlAttributes = new { placeholder = "Name" } })
      @Html.ValidationMessageFor(model =&gt; model.Name, "", new { @class = "danger" })
  &lt;/div&gt;
  &lt;div&gt;
      @Html.EditorFor(model =&gt; model.Phone, new { htmlAttributes = new { placeholder = "Phone" } })
      @Html.ValidationMessageFor(model =&gt; model.Phone, "", new { @class = "danger" })
  &lt;/div&gt;
  &lt;div&gt;
      @Html.HiddenFor(x =&gt; x.Long, new { @id = "Long"})
      @Html.HiddenFor(x =&gt; x.Lat, new { @id = "Lat"})
  &lt;/div&gt;
  &lt;div&gt;
      &lt;button type="submit"&gt;Save&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I need to add a validation to the long and lat parameters, because I dont want the user to save without choosing a location first. so long and lat should not be lesser than 0.001, so I added the following attribute:</p>
  
  <pre><code>[Range(0.001, float.MaxValue)]
  public float Long { get; set; }
  [Range(0.001, float.MaxValue)]
  public float Lat{ get; set; }
  </code></pre>
  
  <p>I want to validate on Submit click, the fact that <strong>Long and Lat are both not 0.00</strong>.</p>
  
  <p>How can i do this? <code>@Html.ValidationMessageFor(x=&gt;x.Long)</code> did not work.</p>