I have a validation message for my model:
<td colspan="2">
<div class="rereg-input">
@Html.TranslatedTextBoxFor(m => m.Email)
@Html.ValidationMessageFor(m => m.Email)
</div>
</td>
When the user forgets, the text nicely displays a * beside the field:
But when they enter a bad email, the message gets put on the end. How can I get it under?
You need to rearrange/fix the CSS/HTML structure.
<td colspan="2">
<div class="rereg-input">
@Html.TranslatedTextBoxFor(m => m.Email)
<div>
@Html.ValidationMessageFor(m => m.Email)
</div>
</div>
</td>
You may be better off modifying whatever CSS class MVC puts on the validation message element and set display:block;
.
.validation-message {
/* ... */
display:block;
}
Simply surrounding it with a div should do the trick
<div>@Html.ValidationMessageFor(m => m.Email)</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With