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 advancee.RowElement.BackColor =
CType(_colourConvert.ConvertFromString(e.RowElement.RowInfo.Cells(_StatusColour).Value().ToString), System.Drawing.Color)
Hi,
I have a really strange situation. I have a form that has a radpanel control and all my others controls are on the panel. If I put a RadLabel on the right bottom and if I set the anchor of the label to bottom-right, the location of the label is change.
Here is my setting :
Me.RadPanel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.RadPanel1.Controls.Add(Me.RadLabel1)
Me.RadPanel1.Location = New System.Drawing.Point(603, 385)
Me.RadPanel1.Name = "RadPanel1"
Me.RadPanel1.Size = New System.Drawing.Size(200, 100)
Me.RadPanel1.TabIndex = 14
Me.RadPanel1.Text = "RadPanel1"
Me
.RadLabel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.RadLabel1.Location = New System.Drawing.Point(138, 83)
Me.RadLabel1.Name = "RadLabel1"
Me.RadLabel1.Size = New System.Drawing.Size(59, 14)
Me.RadLabel1.TabIndex = 0
Me.RadLabel1.Text = "RadLabel1"
?me.RadLabel1.Location
{X = 77 Y = 67}
Empty: {X = 0 Y = 0}
IsEmpty: False
X: 77
Y: 67