I'm trying to highlight just one column header.
I would also like the whole column to have a different border to the others.
But I have not managed to modify any element of the header either.
This is the code I am using:
Private
Sub
RadGridView1_CellFormatting(sender
As
Object
, e
As
UI.CellFormattingEventArgs)
Handles
RadGridView1.CellFormatting
If
TypeOf
e.CellElement
Is
GridHeaderCellElement
Then
e.CellElement.Font = myCustomFont
e.CellElement.BorderBoxStyle = BorderBoxStyle.OuterInnerBorders
End
If
End
Sub
Thanks!
5 Answers, 1 is accepted
0
Accepted
Hi Esteban,
For non-data cells, you need to use the ViewCellFormatting event, an example is available here: Formatting Cells.
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
For non-data cells, you need to use the ViewCellFormatting event, an example is available here: Formatting Cells.
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0

Esteban
Top achievements
Rank 1
Iron
Iron
answered on 15 Jul 2018, 05:51 AM
Thank you!
ViewCellFormatting is a correct event.
Not CellFormatting event.
;-)
0

Esteban
Top achievements
Rank 1
Iron
Iron
answered on 25 Jul 2018, 07:14 AM
Hello again!
I have managed to put the letter in bold and I have been able to change the style of the border. But I have not managed to change other properties of the header such as text or backcolor. Any suggestions?
Private Sub RadGridView1_CellFormatting(sender As Object, e As UI.CellFormattingEventArgs) Handles RadGridView1.ViewCellFormatting
If TypeOf e.CellElement Is GridHeaderCellElement Then
If e.CellElement.Text.Last = "*" Then
e.CellElement.Text = "change text" '### NO
e.CellElement.Font = myCustomFont '### YES
e.CellElement.GradientStyle = GradientStyles.Solid '### NO
e.CellElement.BorderGradientStyle = GradientStyles.Solid '### NO
e.CellElement.BackColor = Color.Red '### NO
e.CellElement.BorderColor = Color.Black '### NO
e.CellElement.BorderBoxStyle = BorderBoxStyle.OuterInnerBorders '### YES
Else
e.CellElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local)
e.CellElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local)
End If
End If
End Sub
0

Esteban
Top achievements
Rank 1
Iron
Iron
answered on 26 Jul 2018, 05:54 AM
Solved. I was misusing the methods.
0
Hi Esteban,
I am glad that you have found a solution for this case. Do not hesitate to contact us if you have other questions.
Regards,
Dimitar
Progress Telerik
I am glad that you have found a solution for this case. Do not hesitate to contact us if you have other questions.
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.