I need to know whether there is ValidationMessage or not. Because I want to add to “
tag into the error message.
like
@if (Html.ValidationMessageFor(m => m.UserId)){
Html.ValidationMessageFor(m => m.UserId) + "<br />
}
the above code does not work, anybody know how it make work?
Thank you!
You need to check the ModelState for that particular error. For example:
This could get really ugly if you have it everywhere though. If you need to do this a lot, then create a custom Html Helper extension.