I'm trying to do input validation for an @html checkbox, but given that Razor uses ToString for bools and the like, everything comes out as capitalized. This means that my input validation range and html
[Range(typeof(bool), "true", "true", ErrorMessage = "Residency is required")]
@Html.CheckBoxFor(m => m.IsResident, new { @id = "residentChk" })
Ends up displaying in the source as
<input data-val="true" data-val-range="Residency is required" data-val-range-max="True" data-val-range-min="True" data-val-required="The IsResident field is required." id="residentChk" name="IsResident" type="checkbox" value="true" /><input name="IsResident" type="hidden" value="false" />
With the main culprits of the issue being
data-val-range-min="True" data-val-range-min="True"
Is there anyway to get razor to put these value in as lower case values, or to somehow modify the checkbox to return an upper case value? Im trying to keep parity with the other parts of the code, so I dont want an edge case that handles this with one off js functions if at all possible.