@Html.RequiredLabelFor(x => x.FirstName)
@Html.TextBoxFor(model => model.FirstName, new { Name = "1.first_name", tabindex = "1" })
@Html.ValidationMessageFor(model => model.FirstName)
Is there a reason why when passing second parameter to @Html.TextBoxFor the field is being validated but "validation message" does not appear?
@Html.RequiredLabelFor(x => x.FirstName)
@Html.TextBoxFor(model => model.FirstName)
@Html.ValidationMessageFor(model => model.FirstName)
When using an overload that accepts only one argument (lambda expression) "validation message" is being displayed correctly.
In my understanding the actual property is not being recognized?
Backing property:
[StringLength(100, ErrorMessage = "Max length 100 characters")]
[Required(ErrorMessage = "This field is required")]
[Display(Name = "First name")]
public string FirstName { get; set; }