0

I have simple tabla which display data. Now I have few columns and last column displays only 1 or 0. Now I whant to color in red all row that have value 1 in this last column.

I done this:

...
<tr class="@((row.LastColumn == 1) ? "error" : "")">
  <td>...</td>
  <td>...</td>

  ...

In my Css I have done this:

.error
{
    color:black;
    background-color: red;
}

And if I run app, and View Element in Chrome I can see this in row where is this last Column like 1:

<tr class="error">

So it recognise 1 and change class to "error", but line is not colored in read...

Any idea why?

1
  • maybe you have another style that is applied to that tr and conflicts with the style you want to apply. try putting !important. Like: .error { color: black!important; background-color:red!important; } Commented May 6, 2014 at 7:22

2 Answers 2

1

try this

error
{
   color:black !important;
   background-color: red !important;
 }

If it didn't works then you need to see weather the css class file path.

Sign up to request clarification or add additional context in comments.

Comments

1

Change it to ID instead of class in css and check along with that try to add text in , reason because if there is not data on TD then first time during runtime it doesn't show anything, so if you used text like "blah blah" or what ever, then it starts implementing CSS to that, try this and let us know

<tr id="error"> just enter any text here(once css applied remove this text on tr)
  <td>blah blah</td>
  <td> your data</td>

</tr>

  #error
   {
     border:1px solid black;
         color:black;
       background-color: red;
    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.