Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya
 asked on

Display warning message

Hi Experts,
My view model has this code.


[Required]
[StringLength(50, ErrorMessage = "Your business email address may not exceed 50 characters.")]
[Email]
[DataType(DataType.EmailAddress)]
[DisplayName("Business email")]
public string BusinessEmail { get; set; }

Open in new window



is it possible to add another  'not Required'  warning message when the EmailAddress contains a commercial domain. (For ex: if the email address is "test@yahoo.com" then there should be an warning message.

Please help!!
C#

Avatar of undefined
Last Comment
RadhaKrishnaKiJaya

8/22/2022 - Mon
Darren

Hi

Could you write your own custom validator for the email address and check both email and check for a set of domain names. You would probably need an exhaustive list of domains.

Thanks,

Darren
RadhaKrishnaKiJaya

ASKER
Yes, I want something like that.
Thanks.
ASKER CERTIFIED SOLUTION
RadhaKrishnaKiJaya

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck