TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marius Vasile
590
1.9k
148.6k
asp.net core if condition is not working properly
May 8 2021 9:26 AM
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)
{
<div
class
=
"col-md-3"
>
<span
class
=
"form-control"
style=
"background-color:limegreen"
>@Html.DisplayFor(model => item.RiskLevelF)</span>
</div>
}
@
if
((item.RiskLevelF > Model.GreenHL) && (item.RiskLevelF < Model.YellowHL))
{
<div
class
=
"col-md-3"
>
<span
class
=
"form-control"
style=
"background-color:yellow"
>@Html.DisplayFor(model => item.RiskLevelF)</span>
</div>
}
@
if
(item.RiskLevelF > Model.YellowHL)
{
<div
class
=
"col-md-3"
>
<span
class
=
"form-control text-white"
style=
"background-color:red"
>@Html.DisplayFor(model => item.RiskLevelF)</span>
</div>
}
Reply
Answers (
5
)
Label1 doesn't exist in current context
Effective Paging in a Gridview From a Stored Procedure