I am working on a form registration for ApplicationUser
. There, I have a field Email or phone
like Facebook. I am using DataAnnotation
for model validation. In Data annotation
I get [EmailAddress]
for email validation and [Phone]
for phone number validation. But I need something like [EmailAddressOrPhone]
. So how I can achieve that?
public class RegisterViewModel
{
.....
[Required]
[Display(Name = "Email or Phone")]
public string EmailOrPhone { get; set; }
......
}