按 header 和行值突出显示 gridview 单元格
highlight gridview cell by header and row values
我有一个网格视图,我能够根据该列中的字段名称和单元格条件突出显示单元格。现在我想做同样的事情,但也考虑第二列的行值。下面的例子
性别 |零件号 |小 |介质 |大
男士 | C-888-电视网 | 5 | 6 | 9
男士 | C-777-TV4 | 7 | 7 | 8
因此,如果我想突出显示 C-777-TV4 行中的“7”和中等尺寸,我将如何同时执行这两个标准。这不是基于数字值标准,只是 header "Medium" 的名称和部件号行 "C-777-TV4" 中的字符串值。
这是我收到超出范围错误的新代码:
Protected Sub gridStock_HtmlRowPrepared(sender As Object, e As ASPxGridViewTableRowEventArgs) Handles gridStock.HtmlRowPrepared
If e.RowType <> GridViewRowType.Data Then
Return
End If
Dim name As String = e.GetValue("CorePN").ToString()
If name = "777-M-MBL" Then
e.Row.Cells(10).BackColor = System.Drawing.Color.Red
End If
End Sub
在 e.Row.Cells(10).Backcolor
处出现错误
我需要看你的更多代码。这是我的想法:
If row.Cell(1).Text = "C-777-TV4" Then
e.Row.Cells(5).BackColor = System.Drawing.Color.Cyan
End If
我有一个网格视图,我能够根据该列中的字段名称和单元格条件突出显示单元格。现在我想做同样的事情,但也考虑第二列的行值。下面的例子
性别 |零件号 |小 |介质 |大
男士 | C-888-电视网 | 5 | 6 | 9
男士 | C-777-TV4 | 7 | 7 | 8
因此,如果我想突出显示 C-777-TV4 行中的“7”和中等尺寸,我将如何同时执行这两个标准。这不是基于数字值标准,只是 header "Medium" 的名称和部件号行 "C-777-TV4" 中的字符串值。
这是我收到超出范围错误的新代码:
Protected Sub gridStock_HtmlRowPrepared(sender As Object, e As ASPxGridViewTableRowEventArgs) Handles gridStock.HtmlRowPrepared
If e.RowType <> GridViewRowType.Data Then
Return
End If
Dim name As String = e.GetValue("CorePN").ToString()
If name = "777-M-MBL" Then
e.Row.Cells(10).BackColor = System.Drawing.Color.Red
End If
End Sub
在 e.Row.Cells(10).Backcolor
处出现错误我需要看你的更多代码。这是我的想法:
If row.Cell(1).Text = "C-777-TV4" Then
e.Row.Cells(5).BackColor = System.Drawing.Color.Cyan
End If