OK - at the moment, to validate my pages I am using [Required] in my model in an MVC2 C# project.
For eg in my model I have:
[DisplayName("Username")]
[Required(ErrorMessage = "Please enter a Username")]
public string UserName { get; set; }
... and in my view I have
<%=Html.ValidationMessageFor(x => x.UserName, "*")%>
But then this isn't consistent with the rest of the styling and error trapping of the rest of our site which was written in Classic ASP.
I want to be able to recreate if possible the validation styles in the images below.
So on loading the page (not on submitting) we might see a display similar to this, with alt and title of the M icon displaying "Please enter a Username":
And then if we try and submit with missing values - we see
Again hovering over the red x will display the error message.
Is there a straightforward way of achieving this styling of validation and if so what is the best way to go about it...
Thank you for any helpful hints, tips, suggestions: