Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Learning ExpressiveAnnotations - RequiredIf doesn't display the error message #211

Open
BeautifulLifeIsGood opened this issue Aug 4, 2021 · 0 comments

Comments

@BeautifulLifeIsGood
Copy link

Hello,
I downloaded the ExpressiveAnnotations and tried to implement it in my project. Having trouble getting it to work. The validation message didn't appear. Thank you for your help.

Here is what I got:

[DisplayName("Company Name")]
[RequiredIf("Search_Profile_Type == 'EMPLOYER'")]

public string Search_Company { get; set; }


@Html.ValidationSummary(true, "", new { @Class = "text-danger" })


@Html.LabelFor(m => m.Search_Profile_Type, htmlAttributes: new { @Class = "control-label col-md-2" })

@Html.DropDownListFor(m => m.Search_Profile_Type, new List
{
new SelectListItem{ Text="ALL", Value = "ALL" },
new SelectListItem{ Text="Adjuster (Person)", Value = "ADJUSTER" },
new SelectListItem{ Text="Attorney (Person)", Value = "ATTORNEY" },
new SelectListItem{ Text="Carrier, Self-Insured Employer, Fund (Company)", Value = "CARRIER" },
new SelectListItem{ Text="Employer Contact Person (Person)", Value = "EMP_CONT" },
new SelectListItem{ Text="Employer (Company)", Value = "EMPLOYER" },
new SelectListItem{ Text="Injured Employee (Person)", Value = "IE" },
new SelectListItem{ Text="Other Contact Person (Person)", Value = "OTHERCONT" },
new SelectListItem{ Text="Other Company (Company)", Value = "OTHERCOMP" },
new SelectListItem{ Text="Rehab Provider Company (Company)", Value = "REHABCO" },
new SelectListItem{ Text="Rehab Provider Contact Person (Person)", Value = "RHC_CONT" },
new SelectListItem{ Text="Rehab Provider (Person)", Value = "QRP" },
new SelectListItem{ Text="Third Party Administrator (Company)", Value = "TPA" },
new SelectListItem{ Text="Vendor (School, Bookstore, Training Facility, etc.) (Company)", Value = "VENDOR" },
new SelectListItem{ Text="Vendor Contact Person (Person)", Value = "VEND_CONT" }}, new { @Class = "form-control", @Style = "max-width:400px;height:35px;resize:horizontal" })



@Html.LabelFor(m => m.Search_Company, htmlAttributes: new { @Class = "control-label col-md-2", id = "Search_Company_Label" })

@Html.TextAreaFor(m => m.Search_Company, new { @Class = "form-control", @Style = "max-width:400px;height:35px" })
@Html.ValidationMessageFor(m => m.Search_Company, "", new { @Class = "text-danger" })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant