Hi, I'm surprised no-one's answered you in a whole year. You've probably worked something out or given up by now!
Anyway, I had a similar problem recently and thought I should share my solution. It may be the wrong way to go about it, but it worked.
Basically, I added a few extra columns to my dataset, having populated it with my data from the DB:
- ds.Tables(0).Columns.Add("NewColumnName")
Then cycled through my dataset and where I found the value I wanted to colour Green (in my case), I set the value in my new column to be the name of a specific CSS class I'd set up, e.g:
- For Each r As Data.DataRow In ds.Tables(0).Rows
-
If r("AColumn") IsNot DBNull.Value AndAlso CInt(r("AColumn") = SomeComparingValue Then
-
r("NewColumnName") = "mycssclass"
-
Else
-
r("NewColumnName") = "myothercssclass"
-
End If
-
Next
Finally in my ASPX file, I had the following in bits of my repeater:
- ... class='<%#DataBinder.Eval(Container.DataItem, "NewColumnName")%>' ...
It's a bit messy, but it works.