I'm trying to highlite a cell of a gridview based on a certain value.
DB field named Monday, DB field Named M_H
if M_H = "Y" then I want to highlite the Monday field in the grid only for that row. I'm trying to tweak the below code to only go to the specific cell in that row where cell(16) is = to "Y" the below code highlites the entire column which makes sense based on the code, how do you specify a certain cell ?
Thanks in advance
For i As Integer = 0 To dg.RowCount - 1
If dg.Rows(i).Cells(16).Value.ToString = "Y" Then
dg.Columns(1).DefaultCellStyle.BackColor = Color.Yellow
End If
Next
DB field named Monday, DB field Named M_H
if M_H = "Y" then I want to highlite the Monday field in the grid only for that row. I'm trying to tweak the below code to only go to the specific cell in that row where cell(16) is = to "Y" the below code highlites the entire column which makes sense based on the code, how do you specify a certain cell ?
Thanks in advance
For i As Integer = 0 To dg.RowCount - 1
If dg.Rows(i).Cells(16).Value.ToString = "Y" Then
dg.Columns(1).DefaultCellStyle.BackColor = Color.Yellow
End If
Next