I have three different situations to apply color to div based on if conditions. the single ones (first and third) are working properly the middle one is not. Values exists, already checked. What am I doing wrong?
- @if (item.RiskLevelF < Model.GreenHL)
- {
- class="col-md-3">
- class="form-control" style="background-color:limegreen">@Html.DisplayFor(model => item.RiskLevelF)
- }
- @if ((item.RiskLevelF > Model.GreenHL) && (item.RiskLevelF < Model.YellowHL))
- {
- class="col-md-3">
- class="form-control" style="background-color:yellow">@Html.DisplayFor(model => item.RiskLevelF)
- }
- @if (item.RiskLevelF > Model.YellowHL)
- {
- class="col-md-3">
- class="form-control text-white" style="background-color:red">@Html.DisplayFor(model => item.RiskLevelF)
- }



Marius VasileRank #785 · 2.9K reputationPosted May 9, 2021, 10:57 AM EDT
Marius VasileRank #785 · 2.9K reputationPosted May 8, 2021, 5:32 AM EDT
Marius VasileRank #785 · 2.9K reputationPosted May 8, 2021, 6:20 AM EDT
Rijwan AnsariRank #82 · 24.2K reputationPosted May 9, 2021, 6:45 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted May 8, 2021, 5:29 AM EDT