Let's say I have a model that looks like this:
public class MyModel
{
[DisplayName("Email:")]
[Required(ErrorMessage = "Email is required")]
[Email(ErrorMessage = "Email is invalid")]
public string Email { get; set; }
}
In ASP.NET MVC 2, I'd render the text box and validation like so:
<%=Html.LabelFor(x => x.Email)%>
<%=Html.TextBoxFor(x => x.Email)%>
<%=Html.ValidationMessageFor(x => x.Email)%>
How do I add a second field to allow the user to confirm their email address using the display name and validation from the model's property?