The Input Tag Helper turns a bound property into a configured HTML input. Add asp-for to an input, and ASP.NET Core uses the property's type and DataAnnotations to choose the HTML type, value, name, id, and validation metadata. section 18.2.3
Binding checkout details
With a page model exposing [BindProperty] public UserBindingModel Input { get; set; }, a Razor form can use <input class="form-control" asp-for="Input.Email" />. Because Email has [EmailAddress], the helper produces an email input whose id is Input_Email, whose name is Input.Email, and whose value comes from the property.
Common mappings include:
- Validation annotations add data-val-* attributes for client-side validation; the required jQuery validation scripts must also be included. section 18.2.3
The generated markup preserves model-binding names such as Input.Email, aligns the input id with a label's for attribute, carries the property's current value, and exposes validation messages through data-val-* attributes. You can still add ordinary HTML attributes when the generated output needs customization. section 18.2 section 18.2.3
