I am trying to use a different message for @Html.ValidationMessageFor() in ASP.NET MVC3. This works fine but it seems to make the message be always displayed , e.g. if I do this:
@Html.ValidationMessageFor(model => model.TimesheetEntry.Product)
then the error is only shown when I submit the form and it is invalid. However if I do this:
@Html.ValidationMessageFor(model => model.TimesheetEntry.Product, "custom error")
then that message is displayed as soon as I initially load the page. I’m probably doing something stupid here and any help would be appreciated.
Have you tried the CSS from this question?