This project is read-only.

editorfor not as expected


I have a view, that is bound to a model with the following property

[Display(Name = "Purchase Cost")]
public double? PurchaseCost { get; set; }

that is rendering like this:

<input name="PurchaseCost" class="form-control text-box single-line valid" id="PurchaseCost" aria-invalid="false" aria-describedby="PurchaseCost-error" type="text" value="" data-val="true" data-val-number="The field Purchase Cost must be a number.">

Why would the validation attributes be added if the field is not marked as "required" and it is a nullable object type?

Am I missing something?