This is a migrated thread and some comments may be shown as answers.

Child Template Backcolor

2 Answers 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Toni
Top achievements
Rank 1
Toni asked on 23 Jan 2018, 02:52 PM

Hi

How could I adjust in VB.NET the backcolor of all my child templates?

I mean the property equivalent to TableElement.BackColor for MasterTemplate

I point that area in my attached file

 

Thanks in advance

Kind regards

2 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 23 Jan 2018, 03:14 PM
Hi Toni,

Thank you for writing.

You can achieve the desired result by handling the RadGridView.ViewCellForamtting event: 
Private Sub RadGridView1_ViewCellFormatting(ByVal sender As Object, ByVal e As CellFormattingEventArgs)
    Dim detailCell As GridDetailViewCellElement = TryCast(e.CellElement, GridDetailViewCellElement)
    If detailCell IsNot Nothing Then
        detailCell.NumberOfColors = 1
        detailCell.BackColor = Color.LightGreen
    Else
        e.CellElement.ResetValue(LightVisualElement.NumberOfColorsProperty, Telerik.WinControls.ValueResetFlags.Local)
        e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local)
    End If
End Sub

Additional information on how the grid cells can be formatted is available here: https://docs.telerik.com/devtools/winforms/gridview/cells/formatting-cells.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
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
Toni
Top achievements
Rank 1
answered on 24 Jan 2018, 07:53 AM
It works! Thank you very much Hristo!
Tags
GridView
Asked by
Toni
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Toni
Top achievements
Rank 1
Share this question
or