The following Model has Required attributes for certain parameters:
   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; }
    }
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.
I am validating the required parameters like the following:
<div>
    @Html.EditorFor(model => model.Name, new { htmlAttributes = new { placeholder = "Name" } })
    @Html.ValidationMessageFor(model => model.Name, "", new { @class = "danger" })
</div>
<div>
    @Html.EditorFor(model => model.Phone, new { htmlAttributes = new { placeholder = "Phone" } })
    @Html.ValidationMessageFor(model => model.Phone, "", new { @class = "danger" })
</div>
<div>
    @Html.HiddenFor(x => x.Long, new { @id = "Long"})
    @Html.HiddenFor(x => x.Lat, new { @id = "Lat"})
</div>
<div>
    <button type="submit">Save</button>
</div>
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:
[Range(0.001, float.MaxValue)]
public float Long { get; set; }
[Range(0.001, float.MaxValue)]
public float Lat{ get; set; }
I want to validate on Submit click, the fact that Long and Lat are both not 0.00.
How can i do this? @Html.ValidationMessageFor(x=>x.Long) did not work.
 
     
     
    