Required field validator still firing even after removing from Model & Controller
Required field validator still firing even after removing from Model & Controller
I am getting error regarding required field validator, two field on my razor page & it should not be required. So I removed the [Required]
validation attribute for but still I am getting a message after submit that these fields are required.
[Required]
Below is my model properties.
public decimal Longitude { get; set; }
decimal Latitude { get; set; }
& this is razor.
@Html.TextBoxFor(model => model.Longitude, new { @class = "form-control")
@Html.TextBoxFor(model => model.Latitude, new { @class = "form-control" })
decimal
null
null
make both the attributes nullable.
– Anmol Rathod
Jun 30 at 7:32
Yes its working thank you # Stephen Muecke and #Anmol.
– Sam
Jun 30 at 7:47
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
A
decimal
can never benull
- its must have a value. if you want to allownull
, then make the nullable– Stephen Muecke
Jun 30 at 7:28