I'm trying to change the backcolor of a cell in a gridview control based on the data value for that datavalue. I found the following code, but ran into a problem. The gridview is bound to a stored procedure and the gridview displays correctly.
I run the code from the RowDataBound event on the gridview. When I look at the code what I see in the e.Row.Cells("Status").text value in debug is a "" value for any integer values. If the value is a string then the e.Row.Cells("Service").text shows the correct string value. Could someone give me a hand with the code and how to view the integer values.
Thanks,
Tom
If e.Row.RowType = DataControlRowType.DataRow Then
Select Case Integer.Parse(e.Row.Cells("Status").Text)
Case 1
e.Row.Cells("Status").BackColor = Drawing.Color.Green
e.Row.Cells("Status").ForeColor = Drawing.Color.White
Case 2
e.Row.Cells("Status").BackColor = Drawing.Color.Yellow
Case 3
e.Row.Cells("Status").BackColor = Drawing.Color.Red
e.Row.Cells("Status").ForeColor = Drawing.Color.White
End Select