I am trying to change the rows back and foreground color based on data gleaned from cells. I have tried the below code but the cell data being returned is " " not the Boolean i was expecting from the sql data bound cells.
what am i doing wrong?
| Private Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound |
| Try |
| If (TypeOf (e.Item) Is GridDataItem) Then |
| 'Get the instance of the right type |
| Dim dataBoundItem As GridDataItem = e.Item |
| Debug.WriteLine(dataBoundItem("pause").Text) |
| Dim rclr As Drawing.Color |
| Dim tclr As Drawing.Color |
| If dataBoundItem("pause").Text = True Then |
| rclr = Drawing.Color.DarkOrange |
| tclr = Drawing.Color.Black |
| GoTo RowSet |
| End If |
| If dataBoundItem("ready").Text = True And dataBoundItem("run").Text = True And dataBoundItem("done").Text = True Then |
| 'done |
| rclr = Drawing.Color.Black |
| tclr = Drawing.Color.Gray |
| ElseIf dataBoundItem("ready").Text = True And dataBoundItem("run").Text = True And dataBoundItem("done").Text = False Then |
| 'running |
| rclr = Drawing.Color.DarkSalmon |
| tclr = Drawing.Color.Black |
| ElseIf dataBoundItem("ready").Text = True And dataBoundItem("run").Text = False And dataBoundItem("done").Text = False Then |
| 'ready |
| rclr = Drawing.Color.DarkOliveGreen |
| tclr = Drawing.Color.Black |
| Else |
| 'not set, dont change a thing, well maybe do it incase |
| rclr = Drawing.Color.Black |
| tclr = Drawing.Color.White |
| End If |
| RowSet: |
| Dim Row As TableRow |
| Row = CType(e.Item, TableRow) |
| Row.BackColor = rclr |
| Row.ForeColor = tclr |
| End If |
| Catch ex As Exception |
| End Try |
| End Sub |