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!!
RadhaKrishnaKiJayaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DarrenSenior Software EngineerCommented:
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
RadhaKrishnaKiJayaAuthor Commented:
Yes, I want something like that.
Thanks.
RadhaKrishnaKiJayaAuthor Commented:
Thank you for trying to help. I found some solution.

<script language="javascript" type="text/javascript">
    jQuery(document).ready(function () {
        jQuery("#BusinessEmail").blur(function () {
            jQuery.ajax({
                type: "POST",
                url: '@Url.Action("NonBusinessDomain", "Enroll")',
                data: '{email: "' + jQuery("#BusinessEmail").val() + '" }',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    if (response == true) {
                        var BusinessEmail = jQuery("#BusinessEmail").val();
                         jQuery("#Business_Email_Msg").show();
                    }
                    else {
                        jQuery("#Business_Email_Msg").hide();
                    }
                }
            });
        });
    });
</script>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.