Hello Team,
Am trying to apply a textfield validation in my code but is not working, please assist. thanks
<div class="form-group"> <div class="input-group"> @Html.TextBoxFor(model => model.FinalPay, new { @class = "form-control", @name = "finalsalary", @id = "finalsalary", @placeholder = "Enter Final Pay" }) @Html.ValidationMessageFor(model => model.FinalPay, "", new { @class = "text-danger" }) </div> </div>
MODEL CLASS
[Display(Name = "FinalPay")] [Required(ErrorMessage = "Final pay is required.")]