Reputation: 6964
I wish to bring attention to fields which have not passed model validation. In the case of a textbox, for example, could a red asterisk be printed?
Such as: @Html.EditorFor(m => m.UserName)<span title="The User Name is required.">*</span>
Upvotes: 0
Views: 78
Reputation: 21365
Have you tried something simple like this:
@Html.ValidationMessageFor(model => model.UserName, "*")
You need the following scripts:
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
Upvotes: 1