I have an ASP.NET MVC application with a form that contains the following code. I want to customize it so that when the FirstName field is left blank, the text box displays a red border and shaded background, which is a common design on websites.
Can someone please guide me on how to achieve this effect?
Here is the model class field:
[Required (ErrorMessage ="You must enter a first name")]
public string FirstName { get; set; }
And here is the form field in question:
<div class="form-row">
<label for="FirstName" class="col-3 col-form-label">Number of users to process:</label>
@Html.TextBoxFor(m => m.FirstName, new { @class = "col-6 form-control" })
@Html.ValidationMessageFor(m => m.FirstName, null, new { @class = "text-danger" })
</div>