Hi guys,
a possible solution in VB might look like this (this solution is based on another posting in this forum):
Private Sub gvMessages_CellFormatting(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles gvMessages.CellFormatting
If TypeOf (e.CellElement.ColumnInfo) Is GridViewDataColumn AndAlso Not TypeOf (e.CellElement.RowElement) Is GridTableHeaderRowElement Then
Dim column As GridViewDataColumn
column = e.CellElement.ColumnInfo
If column.FieldName = "Element" Then
If e.CellElement.RowInfo.Cells("Type").Value = "S" Then
If Not e.CellElement.RowInfo.IsCurrent AndAlso Not e.CellElement.RowInfo.IsSelected Then
e.CellElement.BackColor = Color.LightSalmon
e.CellElement.TextAlignment = ContentAlignment.TopLeft
e.CellElement.Font = New Font(SystemFonts.DefaultFont, FontStyle.Bold)
e.CellElement.DrawFill = True
Else
e.CellElement.DrawFill = False
e.CellElement.Font = New Font(SystemFonts.DefaultFont, FontStyle.Regular)
End If
ElseIf e.CellElement.RowInfo.Cells("Type").Value = "C" Then
If Not e.CellElement.RowInfo.IsCurrent AndAlso Not e.CellElement.RowInfo.IsSelected Then
e.CellElement.BackColor = Color.Khaki
e.CellElement.TextAlignment = ContentAlignment.TopLeft
e.CellElement.Font = New Font(SystemFonts.DefaultFont, FontStyle.Regular)
e.CellElement.DrawFill = True
Else
End If
ElseIf e.CellElement.RowInfo.Cells("Type").Value = "E" Then
If Not e.CellElement.RowInfo.IsCurrent AndAlso Not e.CellElement.RowInfo.IsSelected Then
e.CellElement.BackColor = Color.LemonChiffon
e.CellElement.TextAlignment = ContentAlignment.TopRight
e.CellElement.Font = New Font(SystemFonts.DefaultFont, FontStyle.Regular)
e.CellElement.DrawFill = True
Else
End If
End If
End If
End If
End Sub