c# - How to change color of text in rows with DataBinder -


i want change color of text in specific column in each of rows. have several columns, 1 of them named deliverstate can obtain 1 of 2 states - "delivered" or "notdelivered"

<td><%# databinder.eval(container.dataitem, "dbs").tostring()=="1" ? "" : databinder.eval(container.dataitem, "deliver_state")%></td> 

i want change color of text (which can delivered or notdelivered) in each row in column deliverstate green if "delivered" , red if "notdelivered".

what best way in .aspx file?

maybe add class items based on if condition? way can add styling e.g

.notdelivered {    color:red }  .delivered {    color:green }   <td class="<%#evaluated choice : "delivered" : "notdelivered"><...the rest of statement ..></td> 

i maybe suggest put eval a variable can call on evaluation of tenary operator.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -