Hello,
Blas
I have a grid with a status column in which I want to place a red o green ball depending the bound value. I've tried to do that with the next code:
Private
Sub
Grid_CellFormatting(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.WinControls.UI.CellFormattingEventArgs) _
Handles
gridPedidos.CellFormatting, _
gridChrono.CellFormatting, _
gridCentros.CellFormatting, _
gridIncidencias.CellFormatting, _
gridIncidenciasPFR.CellFormatting, _
gridPedidosWeb.CellFormatting
e.CellElement.Image =
Nothing
Dim
column
As
GridViewCommandColumn = TryCast(e.CellElement.ColumnInfo, GridViewCommandColumn)
If
column IsNot
Nothing
Then
Select
Case
column.UniqueName
Case
"Txt"
CType
(e.CellElement.Children(0), RadButtonElement).Image = My.Resources.document_text
CType
(e.CellElement.Children(0), RadButtonElement).ImageAlignment = ImageLayout.Center
Case
"Datos"
CType
(e.CellElement.Children(0), RadButtonElement).Image = My.Resources.table_view
CType
(e.CellElement.Children(0), RadButtonElement).ImageAlignment = ImageLayout.Center
End
Select
End
If
If
e.CellElement.ColumnInfo.Name =
"Status"
AndAlso
TypeOf
e.CellElement.RowInfo
Is
GridViewDataRowInfo
Then
Dim
Status
As
Integer
=
CInt
(e.CellElement.RowInfo.Cells(
"Status"
).Value)
If
Status = 0
Then
e.CellElement.Image = My.Resources.button_green
Else
e.CellElement.Image = My.Resources.button_red
End
If
e.CellElement.Text =
""
End
If
End
Sub
Executing the program the status column is draw right as you can see in the image1 attached. But scrolling horizontally right and left, the red and green balls are showed in other columns (image2)
Thanks in advanceBlas