我想在我的RadGrid基础上突出显示逻辑行错误(与数据库无关)的一行。 我正在使用带有VB.NET的Telerik Ajax .net RadGrid
If ok > 2000 Then
Dim errorRowOrderNumber = ok / 1000
'Get the RadGrid row error index
myErrorRow.Drawing.Color.Red
myErrorRow.Drawing.Color.White
End If
答案 0 :(得分:1)
如果您可以识别项目数据绑定事件的错误条件,请使用此选项:
Protected Sub grid_ItemDataBound(sender As Object, e As GridItemEventArgs)
Try
If TypeOf e.Item Is GridDataItem Then
Dim dataRow = TryCast(e.Item, GridDataItem)
' Replace with validation logic
If True Then
dataRow.BackColor = Drawing.Color.Gray
dataRow.ForeColor = Drawing.Color.White
dataRow.ToolTip = "Some information about this error."
End If
End If
Catch ex As Exception
' handle exception
End Try
End Sub
在任何其他网格命令事件中,您可以获得对同一GridDataItem
对象的引用。
如果您无法使用网格事件,请尝试查看客户端选项。