I have a GridView which I plan to add different colors in each row based on certain conditions.
One such condition is to color the row in a specific color if a number in column 6 is higher than the number in column 7.
If e.Row.Cells(6).Text > e.Row.Cells(7).Text Then e.Row.BackColor = ColorTranslator.FromHtml("#FDD533") Else
However, when I test the code it seems to only change the color when the left most value in column 6 is larger than column 7, regardless of the fact that column 6 is in the hundreds, while column 7 is in the thousands.
I believe the cause is coming from me using
text in the
If statement. However, any instance of number I can think to change doesn't seem to fit into the code:
If e.Row.Cells(6).Number > e.Row.Cells(7).Number Then
If e.Row.Cells(6).Integer > e.Row.Cells(7).Integer Then
These example gives me a message saying
'Number' is not a member of 'System.Web.UI.WebControls.TableCell'
What else can I use that is compatible with the current code?